Gathering detailed insights and metrics for suc-cordova-plugin-file-opener2
Gathering detailed insights and metrics for suc-cordova-plugin-file-opener2
npm install suc-cordova-plugin-file-opener2
Typescript
Module System
Node Version
NPM Version
JavaScript (44.02%)
Java (30.34%)
Objective-C (25.64%)
Total Downloads
400
Last Day
2
Last Week
4
Last Month
10
Last Year
56
318 Stars
264 Commits
587 Forks
29 Watching
3 Branches
34 Contributors
Latest Version
3.1.1
Package Id
suc-cordova-plugin-file-opener2@3.1.1
Unpacked Size
43.96 kB
Size
12.39 kB
File Count
16
NPM Version
6.14.12
Node Version
12.22.1
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
300%
4
Compared to previous week
Last month
900%
10
Compared to previous month
Last year
-6.7%
56
Compared to previous year
No dependencies detected.
This plugin will open a file on your device file system with its default application.
1cordova.plugins.fileOpener2.open( 2 filePath, 3 fileMIMEType, 4 { 5 error : function(){ }, 6 success : function(){ } 7 } 8);
1$ cordova plugin add cordova-plugin-file-opener2
This plugin requires the AndroidX support library.
1$ cordova plugin add cordova-plugin-file-opener2
The following platforms and versions are supported by the latest release:
Cordova CLI 6.0 is supported by 2.0.19, but there are a number of issues, particularly with Android builds (see 232 203 207). Using the cordova-android-support-gradle-release plugin may help.
Opens a file
Open an APK install dialog:
1cordova.plugins.fileOpener2.open( 2 '/Downloads/gmail.apk', 3 'application/vnd.android.package-archive' 4);
Open a PDF document with the default PDF reader and optional callback object:
1cordova.plugins.fileOpener2.open( 2 '/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf 3 'application/pdf', 4 { 5 error : function(e) { 6 console.log('Error status: ' + e.status + ' - Error message: ' + e.message); 7 }, 8 success : function () { 9 console.log('file opened successfully'); 10 } 11 } 12);
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.
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:
1<a href="market://details?id=xxxx" target="_system">Install from Google Play</a> 2<a href="itms-apps://itunes.apple.com/app/my-app/idxxxxxxxx?mt=8" target="_system">Install from App Store</a>
or in code:
1window.open("[market:// or itms-apps:// link]","_system");
Opens with system modal to open file with an already installed app.
1cordova.plugins.fileOpener2.showOpenWithDialog(
2 '/Downloads/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Downloads/starwars.pdf
3 'application/pdf',
4 {
5 error : function(e) {
6 console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
7 },
8 success : function () {
9 console.log('file opened successfully');
10 },
11 position : [0, 0]
12 }
13);
position
array of coordinates from top-left device screen, use for iOS dialog positioning.
Uninstall a package with its ID.
Note: You need to add <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
to your AndroidManifest.xml
1cordova.plugins.fileOpener2.uninstall('com.zynga.FarmVille2CountryEscape', { 2 error : function(e) { 3 console.log('Error status: ' + e.status + ' - Error message: ' + e.message); 4 }, 5 success : function() { 6 console.log('Uninstall intent activity started.'); 7 } 8});
Check if an app is already installed.
1cordova.plugins.fileOpener2.appIsInstalled('com.adobe.reader', { 2 success : function(res) { 3 if (res.status === 0) { 4 console.log('Adobe Reader is not installed.'); 5 } else { 6 console.log('Adobe Reader is installed.') 7 } 8 } 9});
The following limitations apply when opening an APK file for installation:
ACTION_INSTALL_PACKAGE
permission. You can add it by adding this to your app's config.xml
file:1<platform name="android"> 2 <config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android"> 3 <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> 4 </config-file> 5</platform>
cordova.file.externalDataDirectory
, but not from cordova.file.dataDirectory
. Android 7+ does not have this limitation.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. Whether or not your the SD card is treated as a secondary external device depends on your particular phone's set up.
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 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
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 2/16 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-20
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More