[whatwg] canvas, img, file api and blobs

Stef Epardaud stef at epardaud.fr
Tue Feb 16 01:15:03 PST 2010


On Tue, Feb 16, 2010 at 12:13:11AM -0800, Jonas Sicking wrote:
> On Mon, Feb 15, 2010 at 11:47 PM, Maciej Stachowiak <mjs at apple.com> wrote:
> > I still think we need a type for binary data that can represent in-memory
> > resources. Blobs only allow asynchronous access, since they are meant to
> > represent something like a file, a slice of a file, or a chunk of data in an
> > on-disk database. It doesn't make sense to use such an inconvenient
> > interface to pull out the contents of the canvas, which pretty much have to
> > already be in memory.
> >
> > Even something like WebGL's typed arrays would be better, if the ECMAScript
> > committee doesn't come up with a good solution for basic binary data soon.
> 
> Absolutely! I definitely agree that we need a type like this. The
> sooner the better. On that note, do you know what the latest status is
> within ECMA on this? I know you made a proposal on the webapps list
> (or was it here?), did that go anywhere?

I agree we need more access than what the Blob has to offer, like
sequential and random access at least, and read/write, especially if we
are to copy EXIF data from one source image to a computed image.

> However I suspect it'd be useful to be able to extract as Blob object
> as well, for storing in places like databases or to extract a url.

I am not sure I like this "as well" ;) In my case I need to extract
binary data from a canvas, modify this binary data, then send it using
XmlHttpRequest (which only accepts a File or Blob IIRC), so this binary
type has to be accepted by XmlHttpRequest as well, for sending.

Now that I think about it, is it possible to replace a regular form's
file input list (the list of File objects selected from an input of type
"file" with multiple files enabled) with "processed" files? Like data
coming out of a canvas, possibly by storing them locally (via storage)
to get a File instance. Or are we then limited to sending those
processed files via XmlHttpRequest?

-- 
Stéphane Epardaud



More information about the whatwg mailing list