W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: Is BlobBuilder needed?

From: Glenn Maynard <glenn@zewt.org>
Date: Mon, 24 Oct 2011 19:21:39 -0400
Message-ID: <CABirCh8BTQXgXy-3ofhJ=Ciba7_k5WneaP=jysM8HOBgo3qzCA@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: Webapps WG <public-webapps@w3.org>, Eric Uhrhane <ericu@google.com>
On Mon, Oct 24, 2011 at 6:52 PM, Jonas Sicking <jonas@sicking.cc> wrote:

> b = new Blob([blob1, blob2, "some string", myArrayBuffer]);
>

To give another comparison, this incremental appending:

bb = new BlobBuilder();
ongotdataevent = function(blobToAppend) { bb.append(blobToAppend); }
ondatafinishedevent = function() { b = bb.getBlob(); }

can become:

var b = new Blob();
ongotdataevent = function(blobToAppend) { b = new Blob(b, blobToAppend); }

which is nice, too.  (UAs should optimize this to avoid O(n^2) copying, of
course.)

On Mon, Oct 24, 2011 at 7:01 PM, Ojan Vafai <ojan@chromium.org> wrote:

> In theory, a BlobBuilder could be backed by a file on disk, no? The
> advantage is that if you're building something very large, you don't
> necessarily need to be using all that memory. You can imagine a UA having
> Blobs be fully in-memory until they cross some size threshold.
>

Blobs, or parts of Blobs, can be backed by files on disk too.  You don't
need BlobBuilder to get that functionality.

-- 
Glenn Maynard
Received on Monday, 24 October 2011 23:22:10 GMT

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