Re: Is BlobBuilder needed?

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 UTC