Repository: pwlin/cordova-plugin-file-opener2
Branch: master
Commit: 2a8f78082531
Files: 16
Total size: 42.2 KB
Directory structure:
gitextract_jjlz6it0/
├── .github/
│ └── ISSUE_TEMPLATE/
│ └── bug_report.md
├── .gitignore
├── LICENSE
├── README.md
├── package.json
├── plugin.xml
├── src/
│ ├── android/
│ │ ├── io/
│ │ │ └── github/
│ │ │ └── pwlin/
│ │ │ └── cordova/
│ │ │ └── plugins/
│ │ │ └── fileopener2/
│ │ │ ├── FileOpener2.java
│ │ │ └── FileProvider.java
│ │ └── res/
│ │ └── xml/
│ │ └── opener_paths.xml
│ ├── browser/
│ │ └── FileOpener2.js
│ ├── electron/
│ │ └── FileOpener2.js
│ ├── ios/
│ │ ├── FileOpener2.h
│ │ └── FileOpener2.m
│ └── windows/
│ └── fileOpener2Proxy.js
└── www/
├── browser/
│ └── isChrome.js
└── plugins.FileOpener2.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
### Expected Behaviour
### Actual Behaviour
### Reproduce Scenario (including but not limited to)
#### Steps to Reproduce
#### Platform and Version (eg. Android 5.0 or iOS 9.2.1)
#### (Android) What device vendor (e.g. Samsung, HTC, Sony...)
#### Cordova CLI info
cordova info
Here is the output:
#### Plugin version
cordova plugin version | grep cordova-plugin-file-opener2
Here is the output:
#### Sample Code that illustrates the problem
#### Logs taken while reproducing problem
Run
`adb logcat PluginManager:V CordovaPlugin:V CordovaLog:V chromium:V *:S`
while testing the bug in your app to get some output from your error. This will help you to understand more about the nature of your problem.
================================================
FILE: .gitignore
================================================
*.class
*.metals
*.vscode
# Package Files #
*.jar
*.war
*.ear
*.bak
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2013 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
⛔️ NO LONGER MAINTAINED ⛔️
This plugin was originally built back in 2013 to provide an easy way to open files in Cordova applications. Since 2018 the plugin has not been actively maintained, with only the occaisional release to support updates from the community. Due to signficant changes in the way that Android handles permissions from version 11 onwards, this plugin does not work with Android 11 or later and would require significant changes to make this happen.
If someone would like to take on this work and maintain the plugin moving forward please get in touch.
----------
# A File Opener Plugin for Cordova
[](https://www.npmjs.com/package/cordova-plugin-file-opener2) [](https://npm-stat.com/charts.html?package=cordova-plugin-file-opener2)
This plugin will open a file on your device file system with its default application.
```js
cordova.plugins.fileOpener2.open(
filePath,
fileMIMEType,
{
error : function(){ },
success : function(){ }
}
);
```
## Installation
```shell
$ cordova plugin add cordova-plugin-file-opener2
```
## Requirements
The following platforms and versions are supported by the latest release:
- Android 5.1+ / iOS 9+ / Windows / Electron
- Cordova CLI 7.0 or higher
Cordova CLI 6.0 is supported by 2.0.19, but there are a number of issues, particularly with Android builds (see [232](https://github.com/pwlin/cordova-plugin-file-opener2/issues/232) [203](https://github.com/pwlin/cordova-plugin-file-opener2/issues/203) [207](https://github.com/pwlin/cordova-plugin-file-opener2/issues/207)). Using the [cordova-android-support-gradle-release](https://github.com/dpa99c/cordova-android-support-gradle-release) plugin may help.
### Support for Android 11 and later
There have been [reports](https://github.com/pwlin/cordova-plugin-file-opener2/issues/310) of issues using this plugin with Android 11 and later.
### Edit support
The plugin currently does *not* support the editing of files on Android. It may support editing on iOS, but this has not been tested.
## fileOpener2.open(filePath, mimeType, options)
Opens a file
### Supported Platforms
- Android 5.1+
- iOS 9+
- Windows
- Electron
### Quick Examples
Open an APK install dialog:
```javascript
cordova.plugins.fileOpener2.open(
'/Downloads/gmail.apk',
'application/vnd.android.package-archive'
);
```
Open a PDF document with the default PDF reader and optional callback object:
```js
cordova.plugins.fileOpener2.open(
'/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf
'application/pdf',
{
error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function () {
console.log('file opened successfully');
}
}
);
```
__Note on Electron:__ Do not forget to enable Node.js in your app by adding `"nodeIntegration": true` to `platforms/electron/platform_www/cdv-electron-settings.json` file, See [Cordova-Electron documentation](https://cordova.apache.org/docs/en/latest/guide/platforms/electron/index.html#customizing-the-application's-window-options).
### Market place installation
Install From Market: to install an APK from a market place, such as Google Play or the App Store, you can use an `<a>` tag in combination with the `market://` protocol:
```html
<a href="market://details?id=xxxx" target="_system">Install from Google Play</a>
<a href="itms-apps://itunes.apple.com/app/my-app/idxxxxxxxx?mt=8" target="_system">Install from App Store</a>
```
or in code:
```js
window.open("[market:// or itms-apps:// link]","_system");
```
## fileOpener2.showOpenWithDialog(filePath, mimeType, options)
Opens with system modal to open file with an already installed app.
### Supported Platforms
- Android 5.1+
- iOS 9+
### Quick Example
```js
cordova.plugins.fileOpener2.showOpenWithDialog(
'/Downloads/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf
'application/pdf',
{
error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function () {
console.log('file opened successfully');
},
position : [0, 0]
}
);
```
`position` array of coordinates from top-left device screen, use for iOS dialog positioning.
## fileOpener2.uninstall(packageId, callbackContext)
Uninstall a package with its ID.
__Note__: You need to add `<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />` to your `AndroidManifest.xml`
### Supported Platforms
- Android 5.1+
### Quick Example
```js
cordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', {
error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function() {
console.log('Uninstall intent activity started.');
}
});
```
## fileOpener2.appIsInstalled(packageId, callbackContext)
Check if an app is already installed.
### Supported Platforms
- Android 5.1+
### Quick Example
```javascript
cordova.plugins.fileOpener2.appIsInstalled('com.adobe.reader', {
success : function(res) {
if (res.status === 0) {
console.log('Adobe Reader is not installed.');
} else {
console.log('Adobe Reader is installed.')
}
}
});
```
---
## Android APK installation limitation
The following limitations apply when opening an APK file for installation:
- On Android 8+, your application must have the `ACTION_INSTALL_PACKAGE` permission. You can add it by adding this to your app's `config.xml` file:
```xml
<platform name="android">
<config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
</config-file>
</platform>
```
- Before Android 7, you can only install APKs from the "external" partition. For example, you can install from `cordova.file.externalDataDirectory`, but **not** from `cordova.file.dataDirectory`. Android 7+ does not have this limitation.
---
## SD card limitation on Android
It is not always possible to open a file from the SD Card using this plugin on Android. This is because the underlying Android library used [does not support serving files from secondary external storage devices](https://stackoverflow.com/questions/40318116/fileprovider-and-secondary-external-storage). Whether or not your the SD card is treated as a secondary external device depends on your particular phone's set up.
---
## Notes
- 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.
- [It is reported](https://github.com/pwlin/cordova-plugin-file-opener2/issues/2#issuecomment-41295793) that in iOS, you might need to remove `<preference name="iosPersistentFileLocation" value="Library" />` from your `config.xml`
- 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)
---
================================================
FILE: package.json
================================================
{
"name": "cordova-plugin-file-opener2",
"version": "4.0.0",
"description": "A File Opener Plugin for Cordova. (The Original Version)",
"cordova": {
"id": "cordova-plugin-file-opener2",
"platforms": [
"android",
"ios",
"windows",
"electron"
]
},
"repository": {
"type": "git",
"url": "https://github.com/pwlin/cordova-plugin-file-opener2.git"
},
"keywords": [
"ecosystem:cordova",
"cordova-android",
"cordova-ios",
"cordova-windows",
"cordova-electron"
],
"engines": {
"cordovaDependencies": {
"2.0.0": {
"cordova": ">=6.0.0"
},
"3.0.0": {
"cordova": ">=7.0.0"
},
"4.0.0": {
"cordova-android": ">=10.0.0"
}
}
},
"author": {
"name": "pwlin05@gmail.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/pwlin/cordova-plugin-file-opener2/issues"
},
"homepage": "https://github.com/pwlin/cordova-plugin-file-opener2#readme"
}
================================================
FILE: plugin.xml
================================================
<?xml version="1.0" encoding="UTF-8" ?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-file-opener2" version="4.0.0">
<name>File Opener2</name>
<description>A File Opener Plugin for Cordova. (The Original Version)</description>
<license>MIT</license>
<js-module src="www/plugins.FileOpener2.js" name="FileOpener2">
<clobbers target="cordova.plugins.fileOpener2" />
</js-module>
<!-- Android -->
<platform name="android">
<source-file src="src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java" target-dir="src/io/github/pwlin/cordova/plugins/fileopener2" />
<source-file src="src/android/io/github/pwlin/cordova/plugins/fileopener2/FileProvider.java" target-dir="src/io/github/pwlin/cordova/plugins/fileopener2" />
<config-file target="res/xml/config.xml" parent="/*">
<feature name="FileOpener2">
<param name="android-package" value="io.github.pwlin.cordova.plugins.fileopener2.FileOpener2" />
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</config-file>
<config-file target="AndroidManifest.xml" parent="application">
<provider android:name="io.github.pwlin.cordova.plugins.fileopener2.FileProvider" android:authorities="${applicationId}.fileOpener2.provider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
</provider>
</config-file>
<source-file src="src/android/res/xml/opener_paths.xml" target-dir="res/xml" />
</platform>
<!-- iOS -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="FileOpener2">
<param name="ios-package" value="FileOpener2" />
</feature>
</config-file>
<source-file src="src/ios/FileOpener2.m" />
<header-file src="src/ios/FileOpener2.h" />
</platform>
<!-- WP8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="FileOpener2">
<param name="wp-package" value="FileOpener2" />
</feature>
</config-file>
<source-file src="src/wp8/FileOpener2.cs" />
</platform>
<!-- windows -->
<platform name="windows">
<js-module src="src/windows/fileOpener2Proxy.js" name="fileOpener2Proxy">
<merges target="" />
</js-module>
</platform>
<!-- browser -->
<platform name="browser">
<config-file parent="/*" target="config.xml">
<feature name="FileOpener2">
<param name="browser-package" value="FileOpener2"/>
</feature>
</config-file>
<!-- Required for browserify: we always link module below as there is conditional reference
to this module from requestFileSystem and resolveLocalFileSystemURI modules. -->
<js-module src="www/browser/isChrome.js" name="isChrome">
<runs />
</js-module>
<js-module src="src/browser/FileSaver.min.js" name="FileSaver">
<clobbers target="FileSaver"/>
</js-module>
<js-module src="src/browser/FileOpener2.js" name="FileOpener2Proxy">
<runs/>
</js-module>
</platform>
<!-- electron -->
<platform name="electron">
<js-module src="src/electron/FileOpener2.js" name="fileOpener2">
<merges target="" />
</js-module>
</platform>
</plugin>
================================================
FILE: src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java
================================================
/*
The MIT License (MIT)
Copyright (c) 2013 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.pwlin.cordova.plugins.fileopener2;
import java.io.File;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.webkit.MimeTypeMap;
import io.github.pwlin.cordova.plugins.fileopener2.FileProvider;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.PluginResult;
import org.apache.cordova.CordovaResourceApi;
public class FileOpener2 extends CordovaPlugin {
/**
* Executes the request and returns a boolean.
*
* @param action
* The action to execute.
* @param args
* JSONArry of arguments for the plugin.
* @param callbackContext
* The callback context used when calling back into JavaScript.
* @return boolean.
*/
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("open")) {
String fileUrl = args.getString(0);
String contentType = args.getString(1);
Boolean openWithDefault = true;
if(args.length() > 2){
openWithDefault = args.getBoolean(2);
}
this._open(fileUrl, contentType, openWithDefault, callbackContext);
}
else if (action.equals("uninstall")) {
this._uninstall(args.getString(0), callbackContext);
}
else if (action.equals("appIsInstalled")) {
JSONObject successObj = new JSONObject();
if (this._appIsInstalled(args.getString(0))) {
successObj.put("status", PluginResult.Status.OK.ordinal());
successObj.put("message", "Installed");
}
else {
successObj.put("status", PluginResult.Status.NO_RESULT.ordinal());
successObj.put("message", "Not installed");
}
callbackContext.success(successObj);
}
else {
JSONObject errorObj = new JSONObject();
errorObj.put("status", PluginResult.Status.INVALID_ACTION.ordinal());
errorObj.put("message", "Invalid action");
callbackContext.error(errorObj);
}
return true;
}
private void _open(String fileArg, String contentType, Boolean openWithDefault, CallbackContext callbackContext) throws JSONException {
String fileName = "";
try {
CordovaResourceApi resourceApi = webView.getResourceApi();
Uri fileUri = resourceApi.remapUri(Uri.parse(fileArg));
fileName = fileUri.getPath();
} catch (Exception e) {
fileName = fileArg;
}
File file = new File(fileName);
if (file.exists()) {
try {
if (contentType == null || contentType.trim().equals("")) {
contentType = _getMimeType(fileName);
}
Intent intent;
if (contentType.equals("application/vnd.android.package-archive")) {
// https://stackoverflow.com/questions/9637629/can-we-install-an-apk-from-a-contentprovider/9672282#9672282
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
Uri path;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
path = Uri.fromFile(file);
} else {
Context context = cordova.getActivity().getApplicationContext();
path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".fileOpener2.provider", file);
}
intent.setDataAndType(path, contentType);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK);
} else {
intent = new Intent(Intent.ACTION_VIEW);
Context context = cordova.getActivity().getApplicationContext();
Uri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".fileOpener2.provider", file);
intent.setDataAndType(path, contentType);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
}
/*
* @see
* http://stackoverflow.com/questions/14321376/open-an-activity-from-a-cordovaplugin
*/
if(openWithDefault){
cordova.getActivity().startActivity(intent);
}
else{
cordova.getActivity().startActivity(Intent.createChooser(intent, "Open File in..."));
}
callbackContext.success();
} catch (android.content.ActivityNotFoundException e) {
JSONObject errorObj = new JSONObject();
errorObj.put("status", PluginResult.Status.ERROR.ordinal());
errorObj.put("message", "Activity not found: " + e.getMessage());
callbackContext.error(errorObj);
}
} else {
JSONObject errorObj = new JSONObject();
errorObj.put("status", PluginResult.Status.ERROR.ordinal());
errorObj.put("message", "File not found");
callbackContext.error(errorObj);
}
}
private String _getMimeType(String url) {
String mimeType = "*/*";
int extensionIndex = url.lastIndexOf('.');
if (extensionIndex > 0) {
String extMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(url.substring(extensionIndex+1));
if (extMimeType != null) {
mimeType = extMimeType;
}
}
return mimeType;
}
private void _uninstall(String packageId, CallbackContext callbackContext) throws JSONException {
if (this._appIsInstalled(packageId)) {
Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
intent.setData(Uri.parse("package:" + packageId));
cordova.getActivity().startActivity(intent);
callbackContext.success();
}
else {
JSONObject errorObj = new JSONObject();
errorObj.put("status", PluginResult.Status.ERROR.ordinal());
errorObj.put("message", "This package is not installed");
callbackContext.error(errorObj);
}
}
private boolean _appIsInstalled(String packageId) {
PackageManager pm = cordova.getActivity().getPackageManager();
boolean appInstalled = false;
try {
pm.getPackageInfo(packageId, PackageManager.GET_ACTIVITIES);
appInstalled = true;
} catch (PackageManager.NameNotFoundException e) {
appInstalled = false;
}
return appInstalled;
}
}
================================================
FILE: src/android/io/github/pwlin/cordova/plugins/fileopener2/FileProvider.java
================================================
/*
The MIT License (MIT)
Copyright (c) 2013 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.pwlin.cordova.plugins.fileopener2;
/*
* http://stackoverflow.com/questions/40746144/error-with-duplicated-fileprovider-in-manifest-xml-with-cordova/41550634#41550634
*/
public class FileProvider extends androidx.core.content.FileProvider {
}
================================================
FILE: src/android/res/xml/opener_paths.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!-- https://developer.android.com/reference/android/support/v4/content/FileProvider.html#SpecifyFiles -->
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!-- cordova.file.dataDirectory -->
<files-path name="files" path="." />
<!-- cordova.file.cacheDirectory -->
<cache-path name="cache" path="." />
<!-- cordova.file.externalDataDirectory -->
<external-files-path name="external-files" path="." />
<!-- cordova.file.externalCacheDirectory -->
<external-cache-path name="external-cache" path="." />
<!-- cordova.file.externalRootDirectory -->
<external-path name="external" path="." />
</paths>
================================================
FILE: src/browser/FileOpener2.js
================================================
/*
The MIT License (MIT)
Copyright (c) 2019 fefc - fefc.dev@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const cacheDirectory = (require('./isChrome')()) ? 'filesystem:' + window.location.origin + '/temporary/' : 'file:///temporary/';
const dataDirectory = (require('./isChrome')()) ? 'filesystem:' + window.location.origin + '/persistent/' : 'file:///persistent/';
function open(successCallback, errorCallback, data) {
var fullFilePath = data[0];
//var contentType = data[1]; //Not needed in browser
//var openDialog = data[2]; //Not needed in browser
var dirPath = fullFilePath.substring(0, fullFilePath.lastIndexOf('/') + 1);
var fileName = fullFilePath.substring(fullFilePath.lastIndexOf('/') + 1, fullFilePath.length);
var fileSystemLocalPath = getLocalPathAndFileSystem(dirPath);
if (!fileSystemLocalPath.error) {
window.requestFileSystem(fileSystemLocalPath.fileSystem, 0, (fs) => {
readFile(fs.root, fileSystemLocalPath.localPath + fileName).then((blob) => {
FileSaver.saveAs(blob, fileName);
successCallback();
}).catch((error) => {
errorCallback(error);
});
}, (error) => {
errorCallback(error);
});
} else {
errorCallback('INVALID_PATH');
}
}
/**
*
* Gets the localPath according to the fileSystem (TEMPORARY or PERSISTENT).
*
* @param {String} Path to the file or directory to check
* @returns {Object} value with informations to requestFileSystem later
* @returns {string} value.localPath The localPath in relation with fileSystem.
* @returns {number} value.fileSystem the fileSystem (TEMPORARY or PERSISTENT).
* @returns {error} value.error if the path is not valid.
* @returns {message} value.message error message.
*/
function getLocalPathAndFileSystem(pathToCheck) {
let ret = {
localPath: '',
fileSystem: window.TEMPORARY
};
if (pathToCheck.startsWith(cacheDirectory)) {
ret.localPath = pathToCheck.replace(cacheDirectory, '');
ret.fileSystem = window.TEMPORARY;
} else if (pathToCheck.startsWith(dataDirectory)) {
ret.localPath = pathToCheck.replace(dataDirectory, '');
ret.fileSystem = window.PERSISTENT;
} else {
return {error: true, message: 'INVALID_PATH'};
}
if (!ret.localPath.endsWith('/')) ret.localPath += '/';
return ret;
}
/**
*
* Reads a file in the fileSystem as an DataURL.
*
* @param {String} Root is the root folder of the fileSystem.
* @param {String} Path is the file to be red.
* @returns {Promise} which resolves with an Object containing DataURL, rejects if something went wrong.
*/
function readFile(root, filePath) {
return new Promise((resolve, reject) => {
if (filePath.startsWith('/')) filePath = filePath.substring(1);
root.getFile(filePath, {}, (fileEntry) => {
fileEntry.file((file) => {
let reader = new FileReader();
reader.onload = function() {
resolve(reader.result);
};
reader.onerror = function() {
reject(reader.error);
}
reader.readAsDataURL(file);
}, (error) => {
reject(error);
});
}, (error) => {
reject(error);
});
});
}
module.exports = {
open: open
};
require( "cordova/exec/proxy" ).add( "FileOpener2", module.exports );
================================================
FILE: src/electron/FileOpener2.js
================================================
/*
The MIT License (MIT)
Copyright (c) 2020 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// https://www.electronjs.org/docs/api/shell
const { shell } = global.require('electron');
module.exports = {
open: function (onSuccess, onError, fileName) {
var opn = shell.openItem(fileName[0]);
if (opn === true) {
onSuccess(true);
} else {
onError({'status': 0, 'message': 'Failed opening file.'});
}
}
};
require('cordova/exec/proxy').add('FileOpener2', module.exports);
================================================
FILE: src/ios/FileOpener2.h
================================================
/*
The MIT License (MIT)
Copyright (c) 2013 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#import <Cordova/CDV.h>
@interface FileOpener2 : CDVPlugin <UIDocumentInteractionControllerDelegate> {
NSString *localFile;
}
@property(nonatomic, strong) UIDocumentInteractionController *controller;
@property(nonatomic, strong) CDVViewController *cdvViewController;
- (void) open: (CDVInvokedUrlCommand*)command;
@end
================================================
FILE: src/ios/FileOpener2.m
================================================
/*
The MIT License (MIT)
Copyright (c) 2013 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#import "FileOpener2.h"
#import <Cordova/CDV.h>
#import <QuartzCore/QuartzCore.h>
#import <MobileCoreServices/MobileCoreServices.h>
@implementation FileOpener2
@synthesize controller = docController;
CDVPluginResult* pluginResult = nil;
NSString* callbackId = nil;
- (void) open: (CDVInvokedUrlCommand*)command {
callbackId = command.callbackId;
NSString *path = [command.arguments objectAtIndex:0];
NSString *contentType = [command.arguments objectAtIndex:1];
BOOL showPreview = YES;
if ([command.arguments count] >= 3) {
showPreview = [[command.arguments objectAtIndex:2] boolValue];
}
CDVViewController* cont = (CDVViewController*)[super viewController];
self.cdvViewController = cont;
NSString *uti = nil;
if ([contentType length] == 0) {
NSArray *dotParts = [path componentsSeparatedByString:@"."];
NSString *fileExt = [dotParts lastObject];
uti = (__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExt, NULL);
} else {
uti = (__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (__bridge CFStringRef)contentType, NULL);
}
dispatch_async(dispatch_get_main_queue(), ^{
NSURL *fileURL = NULL;
NSString *decodedPath = [path stringByRemovingPercentEncoding];
if ([path isEqualToString:decodedPath]) {
NSLog(@"Path parameter not encoded. Building file URL encoding it...");
fileURL = [NSURL fileURLWithPath:[path stringByReplacingOccurrencesOfString:@"file://" withString:@""]];;
} else {
NSLog(@"Path parameter already encoded. Building file URL without encoding it...");
fileURL = [NSURL URLWithString:path];
}
localFile = fileURL.path;
NSLog(@"looking for file at %@", fileURL);
NSFileManager *fm = [NSFileManager defaultManager];
if (![fm fileExistsAtPath:localFile]) {
NSDictionary *jsonObj = @{@"status" : @"9",
@"message" : @"File does not exist"};
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:jsonObj];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
}
docController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
docController.delegate = self;
docController.UTI = uti;
//Opens the file preview
CGRect rect;
if ([command.arguments count] >= 4) {
NSArray *positionValues = [command.arguments objectAtIndex:3];
if (![positionValues isEqual:[NSNull null]] && [positionValues count] >= 2) {
rect = CGRectMake(0, 0, [[positionValues objectAtIndex:0] floatValue], [[positionValues objectAtIndex:1] floatValue]);
} else {
rect = CGRectMake(0, 0, 0, 0);
}
} else {
rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
}
BOOL wasOpened = NO;
if (showPreview) {
wasOpened = [docController presentPreviewAnimated: NO];
} else {
CDVViewController* cont = self.cdvViewController;
wasOpened = [docController presentOpenInMenuFromRect:rect inView:cont.view animated:YES];
}
if (wasOpened) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @""];
} else {
NSDictionary *jsonObj = [ [NSDictionary alloc]
initWithObjectsAndKeys :
@"9", @"status",
@"Could not handle UTI", @"message",
nil
];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:jsonObj];
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
}
});
}
@end
@implementation FileOpener2 (UIDocumentInteractionControllerDelegate)
- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller {
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
}
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller {
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
}
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller {
UIViewController *presentingViewController = self.viewController;
if (presentingViewController.view.window != [UIApplication sharedApplication].keyWindow) {
presentingViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
}
while (presentingViewController.presentedViewController != nil && ![presentingViewController.presentedViewController isBeingDismissed]) {
presentingViewController = presentingViewController.presentedViewController;
}
return presentingViewController;
}
@end
================================================
FILE: src/windows/fileOpener2Proxy.js
================================================
var cordova = require('cordova'),
fileOpener2 = require('./FileOpener2');
var schemes = [
{ protocol: 'ms-app', getFile: getFileFromApplicationUri },
{ protocol: 'cdvfile', getFile: getFileFromFileUri } //protocol cdvfile
]
function nthIndex(str, pat, n) {
var L = str.length, i = -1;
while (n-- && i++ < L) {
i = str.indexOf(pat, i);
if (i < 0) break;
}
return i;
}
function getFileFromApplicationUri(uri) {
/* bad path from a file entry due to the last '//'
example: ms-appdata:///local//path/to/file
*/
var index = nthIndex(uri, "//", 3);
var newUri = uri.substr(0, index) + uri.substr(index + 1);
var applicationUri = new Windows.Foundation.Uri(newUri);
return Windows.Storage.StorageFile.getFileFromApplicationUriAsync(applicationUri);
}
function getFileFromFileUri(uri) {
/* uri example:
cdvfile://localhost/persistent|temporary|another-fs-root/path/to/file
*/
var indexFrom = nthIndex(uri, "/", 3) + 1;
var indexTo = nthIndex(uri, "/", 4);
var whichFolder = uri.substring(indexFrom, indexTo);
var filePath = uri.substr(indexTo + 1);
var path = "\\" + filePath;
if (whichFolder == "persistent") {
path = Windows.Storage.ApplicationData.current.localFolder.path + path;
}
else { //temporary, note: no roaming management
path = Windows.Storage.ApplicationData.current.temporaryFolder.path + path;
}
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) {
var path = args[0];
var getFile = getFileLoaderForScheme(path);
getFile(path).then(function (file) {
var options = new Windows.System.LauncherOptions();
try{
Windows.System.Launcher.launchFileAsync(file, options).then(function (success) {
successCallback();
}, function (error) {
errorCallback(error);
});
}catch(error){
errorCallback(error);
}
}, function (error) {
console.log("Error while opening the file: "+error);
errorCallback(error);
});
}
};
require("cordova/exec/proxy").add("FileOpener2", module.exports);
================================================
FILE: www/browser/isChrome.js
================================================
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
module.exports = function () {
// window.webkitRequestFileSystem and window.webkitResolveLocalFileSystemURL are available only in Chrome and
// possibly a good flag to indicate that we're running in Chrome
return window.webkitRequestFileSystem && window.webkitResolveLocalFileSystemURL;
};
================================================
FILE: www/plugins.FileOpener2.js
================================================
/*jslint browser: true, devel: true, node: true, sloppy: true, plusplus: true*/
/*global require, cordova */
/*
The MIT License (MIT)
Copyright (c) 2013 pwlin - pwlin05@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
var exec = require('cordova/exec');
function FileOpener2() {}
FileOpener2.prototype.open = function (fileName, contentType, callbackContext) {
contentType = contentType || '';
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType]);
};
FileOpener2.prototype.showOpenWithDialog = function (fileName, contentType, callbackContext) {
contentType = contentType || '';
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'open', [fileName, contentType, false, callbackContext.position || [0, 0]]);
};
FileOpener2.prototype.uninstall = function (packageId, callbackContext) {
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'uninstall', [packageId]);
};
FileOpener2.prototype.appIsInstalled = function (packageId, callbackContext) {
callbackContext = callbackContext || {};
exec(callbackContext.success || null, callbackContext.error || null, 'FileOpener2', 'appIsInstalled', [packageId]);
};
module.exports = new FileOpener2();
gitextract_jjlz6it0/
├── .github/
│ └── ISSUE_TEMPLATE/
│ └── bug_report.md
├── .gitignore
├── LICENSE
├── README.md
├── package.json
├── plugin.xml
├── src/
│ ├── android/
│ │ ├── io/
│ │ │ └── github/
│ │ │ └── pwlin/
│ │ │ └── cordova/
│ │ │ └── plugins/
│ │ │ └── fileopener2/
│ │ │ ├── FileOpener2.java
│ │ │ └── FileProvider.java
│ │ └── res/
│ │ └── xml/
│ │ └── opener_paths.xml
│ ├── browser/
│ │ └── FileOpener2.js
│ ├── electron/
│ │ └── FileOpener2.js
│ ├── ios/
│ │ ├── FileOpener2.h
│ │ └── FileOpener2.m
│ └── windows/
│ └── fileOpener2Proxy.js
└── www/
├── browser/
│ └── isChrome.js
└── plugins.FileOpener2.js
SYMBOL INDEX (17 symbols across 6 files)
FILE: src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java
class FileOpener2 (line 47) | public class FileOpener2 extends CordovaPlugin {
method execute (line 60) | public boolean execute(String action, JSONArray args, CallbackContext ...
method _open (line 94) | private void _open(String fileArg, String contentType, Boolean openWit...
method _getMimeType (line 159) | private String _getMimeType(String url) {
method _uninstall (line 171) | private void _uninstall(String packageId, CallbackContext callbackCont...
method _appIsInstalled (line 186) | private boolean _appIsInstalled(String packageId) {
FILE: src/android/io/github/pwlin/cordova/plugins/fileopener2/FileProvider.java
class FileProvider (line 28) | public class FileProvider extends androidx.core.content.FileProvider {
FILE: src/browser/FileOpener2.js
function open (line 27) | function open(successCallback, errorCallback, data) {
function getLocalPathAndFileSystem (line 63) | function getLocalPathAndFileSystem(pathToCheck) {
function readFile (line 94) | function readFile(root, filePath) {
FILE: src/ios/FileOpener2.h
function interface (line 26) | interface FileOpener2 : CDVPlugin <UIDocumentInteractionControllerDelega...
FILE: src/windows/fileOpener2Proxy.js
function nthIndex (line 10) | function nthIndex(str, pat, n) {
function getFileFromApplicationUri (line 19) | function getFileFromApplicationUri(uri) {
function getFileFromFileUri (line 31) | function getFileFromFileUri(uri) {
function getFileFromNativePath (line 51) | function getFileFromNativePath(path) {
function getFileLoaderForScheme (line 57) | function getFileLoaderForScheme(path) {
FILE: www/plugins.FileOpener2.js
function FileOpener2 (line 27) | function FileOpener2() {}
Condensed preview — 16 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (47K chars).
[
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 834,
"preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n### Expected Beh"
},
{
"path": ".gitignore",
"chars": 69,
"preview": "*.class\n*.metals\n*.vscode\n\n# Package Files #\n*.jar\n*.war\n*.ear\n*.bak\n"
},
{
"path": "LICENSE",
"chars": 1092,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to an"
},
{
"path": "README.md",
"chars": 7772,
"preview": " ⛔️ NO LONGER MAINTAINED ⛔️ \r\n\r\nThis plugin was originally built back in 2013 to provide an easy way to open files in C"
},
{
"path": "package.json",
"chars": 1005,
"preview": "{\n \"name\": \"cordova-plugin-file-opener2\",\n \"version\": \"4.0.0\",\n \"description\": \"A File Opener Plugin for Cordova. (Th"
},
{
"path": "plugin.xml",
"chars": 3699,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<plugin xmlns=\"http://www.phonegap.com/ns/plugins/1.0\" xmlns:android=\"http://sch"
},
{
"path": "src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java",
"chars": 7137,
"preview": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to"
},
{
"path": "src/android/io/github/pwlin/cordova/plugins/fileopener2/FileProvider.java",
"chars": 1361,
"preview": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to"
},
{
"path": "src/android/res/xml/opener_paths.xml",
"chars": 695,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- https://developer.android.com/reference/android/support/v4/content/FileProvi"
},
{
"path": "src/browser/FileOpener2.js",
"chars": 4385,
"preview": "/*\r\nThe MIT License (MIT)\r\n\r\nCopyright (c) 2019 fefc - fefc.dev@gmail.com\r\n\r\nPermission is hereby granted, free of charg"
},
{
"path": "src/electron/FileOpener2.js",
"chars": 1505,
"preview": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2020 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to"
},
{
"path": "src/ios/FileOpener2.h",
"chars": 1425,
"preview": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to"
},
{
"path": "src/ios/FileOpener2.m",
"chars": 5758,
"preview": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2013 pwlin - pwlin05@gmail.com\n\nPermission is hereby granted, free of charge, to"
},
{
"path": "src/windows/fileOpener2Proxy.js",
"chars": 2897,
"preview": "\n\tvar cordova = require('cordova'),\n\t\tfileOpener2 = require('./FileOpener2');\n\n\tvar schemes = [\n { protocol: 'ms-"
},
{
"path": "www/browser/isChrome.js",
"chars": 1117,
"preview": "/*\n *\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the "
},
{
"path": "www/plugins.FileOpener2.js",
"chars": 2428,
"preview": "/*jslint browser: true, devel: true, node: true, sloppy: true, plusplus: true*/\n/*global require, cordova */\n/*\nThe MIT "
}
]
About this extraction
This page contains the full source code of the pwlin/cordova-plugin-file-opener2 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 16 files (42.2 KB), approximately 10.7k tokens, and a symbol index with 17 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.