Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-file-opener2

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-file-opener2 - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "cordova-plugin-file-opener2",
"version": "2.0.0",
"version": "2.0.1",
"description": "A File Opener Plugin for Cordova. (The Original Version)",

@@ -5,0 +5,0 @@ "cordova": {

Contributors
------------
[@Gillardo](https://github.com/Gillardo/)
[@Gillardo](https://github.com/Gillardo/), [@TankOs](https://github.com/TankOs), [@Rovi23](https://github.com/Rovi23), [@josemanuelbd](https://github.com/josemanuelbd), [@ielcoro](https://github.com/ielcoro)
[@TankOs](https://github.com/TankOs)
[@Rovi23](https://github.com/Rovi23)
[@josemanuelbd](https://github.com/josemanuelbd)
A File Opener Plugin for Cordova (The Original Version)

@@ -16,2 +10,5 @@ ==========================

Current Version: 2.0.1
----------------
Requirements

@@ -30,3 +27,3 @@ -------------

filePath,
fileType,
fileMIMEType,
{

@@ -65,3 +62,3 @@ error : function(){ },

- For properly opening a any file, you must already have an suitable reader for that particular file type already installed on your device. Otherwise this will not work.
- For properly opening _any_ file, you must already have a suitable reader for that particular file type installed on your device. Otherwise this will not work.

@@ -71,3 +68,5 @@

- If you are wondering what MIME-type should you pass as the second argument to `open` function, [here is a list of all known MIME-types](http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=co)
Additional Android Functions

@@ -74,0 +73,0 @@ -----------------------------

@@ -5,8 +5,45 @@

var schemes = [
{ protocol: 'ms-app', getFile: getFileFromApplicationUri },
{ protocol: 'file:///', getFile: getFileFromFileUri }
]
function getFileFromApplicationUri(uri) {
var applicationUri = new Windows.Foundation.Uri(uri);
return Windows.Storage.StorageFile.getFileFromApplicationUriAsync(applicationUri);
}
function getFileFromFileUri(uri) {
var path = Windows.Storage.ApplicationData.current.localFolder.path +
uri.substr(8);
return getFileFromNativePath(path);
}
function getFileFromNativePath(path) {
var nativePath = path.split("/").join("\\");
return Windows.Storage.StorageFile.getFileFromPathAsync(nativePath);
}
function getFileLoaderForScheme(path) {
var fileLoader = getFileFromNativePath;
schemes.some(function (scheme) {
return path.indexOf(scheme.protocol) === 0 ? ((fileLoader = scheme.getFile), true) : false;
});
return fileLoader;
}
module.exports = {
open: function (successCallback, errorCallback, args) {
Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(function (file) {
var path = args[0];
var getFile = getFileLoaderForScheme(path);
getFile(path).then(function (file) {
var options = new Windows.System.LauncherOptions();
options.displayApplicationPicker = true;

@@ -21,2 +58,4 @@ Windows.System.Launcher.launchFileAsync(file, options).then(function (success) {

}, function (errror) {
console.log("Error abriendo el archivo");
});

@@ -23,0 +62,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc