On Aug 1, 2012, at 8:44 AM, Glenn Maynard <gl...@zewt.org> wrote: > On Wed, Aug 1, 2012 at 9:59 AM, Robin Berjon <ro...@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.
The "HEAD" request seems a little like a FileEntry for use with FileReader. Something similar (very similar) is done for http+fuse on several platforms. It's quite useful for working with large archives such as PDF or ZIP. -Charles