- From: Jonas Sicking <jonas@sicking.cc>
- Date: Mon, 24 Oct 2011 15:52:56 -0700
- To: Webapps WG <public-webapps@w3.org>, Eric Uhrhane <ericu@google.com>
Hi everyone,
It was pointed out to me on twitter that BlobBuilder can be replaced
with simply making Blob constructable. I.e. the following code:
var bb = new BlobBuilder();
bb.append(blob1);
bb.append(blob2);
bb.append("some string");
bb.append(myArrayBuffer);
var b = bb.getBlob();
would become
b = new Blob([blob1, blob2, "some string", myArrayBuffer]);
or look at it another way:
var x = new BlobBuilder();
becomes
var x = [];
x.append(y);
becomes
x.push(y);
var b = x.getBlob();
becomes
var b = new Blob(x);
So at worst there is a one-to-one mapping in code required to simply
have |new Blob|. At best it requires much fewer lines if the page has
several parts available at once.
And we'd save a whole class since Blobs already exist.
/ Jonas
Received on Monday, 24 October 2011 22:53:53 UTC