incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brion Vibber (JIRA)" <>
Subject [jira] [Commented] (CB-622) FileTransfer interface should provide progress monitoring
Date Tue, 03 Jul 2012 22:34:34 GMT


Brion Vibber commented on CB-622:

Consensus on the mailing list seems to be that FileTransfer should get deprecated in favor
of a polyfill for XHR2, but until then it sounds like lots of folks would still love a progress
interface on FileTransfer.

Here's an in-progress patch for Android:

I'm having FileTransfer.upload take a 'progress' option parameter, which if set causes it
to fire the success callback during upload (every buffer push) with the sent bytes so far.
The progress events can be distinguished from the final success because the result object's
responseCode property is -1 rather than an HTTP response code.

I ran this technique past a couple folks on IRC and they told me it wasn't completely crazy,
so opening this for discussion. :)

Seems to work for me; should be easy to do the same for download. Not sure about iOS but it's
probably not super hard there either.

Please give me feedback on whether this seems sane, or any tweaks such as:
* changing the -1 status code on progress events?
* passing a callback into the FileUploadOptions object to make it simpler? (will need some
JS changes I think)
* etc

> FileTransfer interface should provide progress monitoring
> ---------------------------------------------------------
>                 Key: CB-622
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android, BlackBerry, iOS, WP7
>    Affects Versions: 1.7.0
>         Environment: Checked docs for iOS and Android, and in general.
>            Reporter: Brion Vibber
>            Priority: Minor
>              Labels: FileTransfer, file
> The FileTransfer upload and download interface seems to provide no way to monitor progress
of the upload/download, other than waiting for the entire transfer to complete or fail.
> Being able to pass another callback for progress monitoring could be a useful interface,
this might get called with a byte count or something.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message