Gathering detailed insights and metrics for cordova-plugin-file-opener2
Gathering detailed insights and metrics for cordova-plugin-file-opener2
Gathering detailed insights and metrics for cordova-plugin-file-opener2
Gathering detailed insights and metrics for cordova-plugin-file-opener2
@types/cordova-plugin-file-opener2
TypeScript definitions for cordova-plugin-file-opener2
cordova-plugin-file-safe-opener2
A File Opener Plugin for Cordova. (The Original Version)
suc-cordova-plugin-file-opener2
A File Opener Plugin for Cordova. (The Original Version)
@theankur/cordova-plugin-file-opener2
A File Opener Plugin for Cordova. (The Original Version)
A File Opener Plugin for Cordova
npm install cordova-plugin-file-opener2
Typescript
Module System
Node Version
NPM Version
97.7
Supply Chain
100
Quality
80
Maintenance
100
Vulnerability
99.6
License
JavaScript (44.02%)
Java (30.34%)
Objective-C (25.64%)
Total Downloads
6,346,850
Last Day
3,674
Last Week
22,652
Last Month
92,195
Last Year
1,011,574
MIT License
319 Stars
264 Commits
586 Forks
28 Watchers
3 Branches
34 Contributors
Updated on Apr 08, 2025
Latest Version
4.0.0
Package Id
cordova-plugin-file-opener2@4.0.0
Unpacked Size
43.73 kB
Size
12.35 kB
File Count
16
NPM Version
8.13.2
Node Version
18.6.0
Published on
Jan 30, 2023
Cumulative downloads
Total Downloads
Last Day
-25.1%
3,674
Compared to previous day
Last Week
-8.9%
22,652
Compared to previous week
Last Month
25.6%
92,195
Compared to previous month
Last Year
-1.1%
1,011,574
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
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
0 existing vulnerabilities detected
Reason
license file detected
Details
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-05-19
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