This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the plugin cordova-plugin-filepath.
This version comes from a necessity because of the error "column data does not exist" when getting the file path on some phones.
I basicaly edited the getPath method and when the uri scheme is "content" it always call's the method getDriveFilePath that forces the creation of a temporary file with the content of uri received. then it returns the filepath of the temporary file.
$ cordova plugin add cordova-plugin-filepath-generic
- Android
Once installed the plugin defines the window.FilePath
object. To resolve a
file path:
window.FilePath.resolveNativePath('content://...', successCallback, errorCallback);
Returns the file://
file path.
Returns the following object:
{ code: <integer>, message: <string> }
Possible error codes are:
-1
- describes an invalid action0
-file://
path could not be resolved1
- the native path links to a cloud file (e.g: from Google Drive app)
Apache (see LICENSE.md)