W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

Re: Lazy Blob

From: Glenn Maynard <glenn@zewt.org>
Date: Wed, 1 Aug 2012 10:44:49 -0500
Message-ID: <CABirCh-F7+C2akr9cFsLQ2Zx0okupjvX29r9s8sbrtifU1szPA@mail.gmail.com>
To: Robin Berjon <robin@berjon.com>
Cc: WebApps WG <public-webapps@w3.org>, Jungkee Song <jungkee.song@samsung.com>
On Wed, Aug 1, 2012 at 9:59 AM, Robin Berjon <robin@berjon.com> wrote:

> var bb = new BlobBuilder()

,   blob = bb.getBlobFromURL("http://specifiction.com/kitten.png", "GET", {
> Authorization: "Basic DEADBEEF" });
>
> Everything is the same as the previous version but the method and some
> headers can be set by enumerating the Object. I *think* that those are all
> that would ever be needed.
>

We already have an API to allow scripts to make network requests: XHR.
 Please don't create a new API that will end up duplicating all of that.
 However this might be done, it should hang off of XHR.

Ideally, a new responseType could be added to XHR which operates like
"blob", except instead of reading the whole resource, it just performs a
HEAD to retrieve the response length and immediately returns the Blob,
which can be read to perform further Content-Range reads.  This sits
relatively cleanly within the XHR API.  It also has nice security
properties, as if you send that Blob somewhere else--possibly to a
different origin--it can do nothing with the Blob but read it as it was
given.

The trouble is chunked responses, where the length of the resource isn't
known in advance, since Blobs have a static length and aren't designed for
streaming.

-- 
Glenn Maynard
Received on Wednesday, 1 August 2012 15:45:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:54 GMT