RE: File API Feedback

On Thursday, June 18, 2009 6:13 PM, Arun Ranganathan wrote:
> Boris Zbarsky wrote:
> > Ian Hickson wrote:
> >> Local display of images before uploading them requires being able to
> >> take a File object and poke it into parts of the platform that
> >> currently only take URLs. I suggest that the way we address this is
> >> by adding an API to a File object that returns a URL like this:
> >>
> >>    scheme:uuid
> >
> > Can't one already get data out of a File object?  And if so, is there
> > a reason to not just have a way of getting a data: url representing
> > that data out of one?
> This can be done in existing versions of Firefox synchronously, and in
> the existing editor's draft asynchronously (via getAsDataURI which
> should be renamed).
> 
> I think the original discussion about this (re-reading IRC notes) was
> to have a "short-lived" URL (as locator, not as a Base64 dump) in the
> scope of the script that actually referred to the file.  Upon reflection,
> Data URLs satisfy the use case for URLs to "... poke into parts of the
> platform that currently take only URLs."
> 
> Hixie, I think a Base64 representation of the file resource may be
> sufficient, particularly for the image use case (which is how it is
> used already).  Can you flesh out why the new schema is a good idea?

I'd be concerned about the size. If you have a large file then exploding it into base64 just to copy it somewhere else into the platform where it will be decoded into yet another copy doesn't seem optimal. It may be a good v1 solution though.

Ade.

Received on Friday, 19 June 2009 03:09:05 UTC