incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse <purplecabb...@gmail.com>
Subject Re: Enlighten me on the point of the FileTransfer API
Date Sat, 23 Jun 2012 20:47:25 GMT
Currently if you want to download an image without the FileTransfer API you
would have to :
- load the image with a DOM Image element, and listen for the load event
- render it into a canvas
- request the base64 encoded data from the canvas
- save it to file with the File API as base64 encoded data

Then every time you want to display it :
- load it with XHR or File API
- assign it's data to the src of an image

Being able to Download and Save to the file system on the native side will
prevent having to constantly convert between binary + base64.

I think that the FileTransfer API will still be relevant even after XHR2 is
ubiquitous because it is much friendlier on memory, and could even support
file-streaming uploads.

Ultimately FileTransfer will be a plugin like everything else, but I don't
see it going anywhere because of the availability of XHR2.  I would even
like to see additions to the API to manage an upload/download queue, and
possibly support background filetransfers as well. Download throttling
based on bandwidth availability or battery, ...






On Sat, Jun 23, 2012 at 10:42 AM, Brian LeRoux <b@brian.io> wrote:

> Heh!
>
> On Friday, June 22, 2012, Jesse MacFadyen wrote:
>
> > FileTransfer makes lots of sense!
> > Think binary.
> >
> > Cheers,
> >  Jesse
> >
> >
> > On 2012-06-22, at 5:50 PM, Dave Johnson <dave.c.johnson@gmail.com
> <javascript:;>>
> > wrote:
> >
> > > Yah it's essentially xhr2.
> > >
> > > Android < 4 (amongst others) doesn't have xhr2 tho.
> > >
> > > On Friday, June 22, 2012, Gord Tanner wrote:
> > >
> > >> Looking at:
> > >>
> > http://docs.phonegap.com/en/1.8.1/cordova_file_file.md.html#FileTransfer
> > >>
> > >> I am wondering why we need to go to native for this API and what the
> use
> > >> case is for it?
> > >>
> > >> Why wouldn't we just end up routing these calls to an XHR form post in
> > the
> > >> browser? (and XHR for download).
> > >>
> > >> Gord
> > >>
> >
>



-- 
@purplecabbage
risingj.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message