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

Re: Is BlobBuilder needed?

From: Eric U <ericu@google.com>
Date: Tue, 15 Nov 2011 09:14:22 -0800
Message-ID: <CAHvSExeS1WsR5VR_3ok9egLseyjr2SvwBHM85sRKo3YTw7QADQ@mail.gmail.com>
To: Rich Tibbett <richt@opera.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Webapps WG <public-webapps@w3.org>
On Tue, Nov 15, 2011 at 5:41 AM, Rich Tibbett <richt@opera.com> wrote:
> Jonas Sicking wrote:
>>
>> 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.
>
> Following the previous discussion (which seemed to raise no major
> objections) can we expect to see this in the File API spec sometime soon
> (assuming that spec is the right home for this)?
>
> This will require a coordinated edit to coincide with the removal of
> BlobBuilder from the File Writer API, right?

It need not be all that coordinated.  I can take it out [well...mark
it deprecated, pending implementation changes] any time after the Blob
constructor goes into the File API.

> Thanks,
>
> Rich
>
>>
>> / Jonas
>
Received on Tuesday, 15 November 2011 17:15:12 GMT

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