PhoneGap File Plugin
platforms: android
$ cordova plugin add com.surfernetwork.fileplugin


This plugin will download and copy file from a url to the app directory and read it as well. In case it doesn't find the file from a url it can also copy an alternate default file from the app resources.


Assuming PhoneGap CLI is installed, from the command line.

phonegap local plugin add

PhoneGap Build

Add the following xml to your config.xml to always use the latest version of this plugin:

<gap:plugin name="com.surfernetwork.fileplugin" />

or to use an specific version:

<gap:plugin name="com.surfernetwork.fileplugin" version="1.0.2" />

More informations can be found here .

How to Use

It supports Phonegap 3.0 and above

This plugin will retun the file contents in string format after downloading and coping on to device.

From index.js you may call plugin by passing parameters.

    var returnSuccess='success';
    var SettingsFileName='abc.xml';
    var SettingsDownloadUrl='';
var base='';
    var base='www/xml/';
    var success = function(result) { 
                console.log("SUCCESS: \r\n"+result );    

    var error = function(error) { 
                      console.error("ERROR: \r\n"+error ); 
   FilePlugin.callNativeFunction( success, error,{'result':returnSuccess,'file':SettingsFileName,'downloadurl':SettingsDownloadUrl,'base_path':base} );