cordova-filepath-resolver

1.0.5 • Public • Published

cordova-filepath-resolver

This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library.

Original inspiration from StackOverflow.

Original version by hiddentao.

This version requires at least Cordova 6.0.0, and solves the permission issues in Android 6.

Installation

$ cordova plugin add cordova-filepath-resolver
  • Ionic

For Ionic specifically, you can also use:

$ ionic plugin add cordova-filepath-resolver

Supported Platforms

  • Android

Usage

Once installed the plugin defines the window.FilePath object. To resolve a file path:

window.FilePath.resolveNativePath('content://...', successCallback, errorCallback);
AngularJS

When using this with AngularJS (for instance, in Ionic), you can (also) retrieve a reference to the FilePath function via the $window object:

$window['FilePath'].resolveNativePath('content://...', successCallback, errorCallback);
successCallback

Returns the file:// file path.

errorCallback

Returns the following object:

{ code: <integer>, message: <string> }

Possible error codes are:

  • -1 - describes an invalid action
  • 0 - file:// path could not be resolved
  • 1 - the native path links to a cloud file (e.g: from Google Drive app)

LICENSE

Apache (see LICENSE.md)

Package Sidebar

Install

npm i cordova-filepath-resolver

Weekly Downloads

0

Version

1.0.5

License

Apache 2.0

Unpacked Size

30.9 kB

Total Files

8

Last publish

Collaborators

  • gjoris