cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rakatyal <>
Subject [GitHub] cordova-plugin-file-transfer pull request: adding sample section t...
Date Mon, 11 Apr 2016 22:54:05 GMT
Github user rakatyal commented on a diff in the pull request:
    --- Diff: ---
    @@ -315,3 +315,231 @@ If you are upgrading to a new (1.0.0 or newer) version of File,
and you have pre
     which can be used in place of the absolute file path in both `download()` and `upload()`
    +## Sample: Download and Upload Files <a name="sample"></a>
    +Use the File-Transfer plugin to upload and download files. In these examples, we demonstrate
several tasks like:
    +* Downloading a binary file to the application cache
    +* Uploading a file created in your application's root
    +* Downloading the uploaded file
    +## Download a Binary File to the application cache
    +Use the File plugin with the File-Transfer plugin to provide a target for the files that
you download (the target must be a FileEntry object). Before you download the file, create
a DirectoryEntry object by using `resolveLocalFileSystemURL` and calling `fs.root` in the
success callback. Use the `getFile` method of DirectoryEntry to create the target file.
    +window.requestFileSystem(window.TEMPORARY, 5 * 1024 * 1024, function (fs) {
    +    console.log('file system open: ' +;
    +    // Make sure you add the domain name to the Content-Security-Policy <meta>
    +    var url = '';
    +    fs.root.getFile('downloaded-image.png', { create: true, exclusive: false }, function
(fileEntry) {
    +        download(fileEntry, url, true);
    +    }, onErrorCreateFile);
    +}, onErrorLoadFs);
    +>*Note* For persistent storage, pass LocalFileSystem.PERSISTENT to requestFileSystem.
    --- End diff --
    Consider adding a note explaining the 'exclusive' and 'create' options for the getFile

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message