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

Re: Is BlobBuilder needed?

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 24 Oct 2011 19:54:08 -0700
Message-ID: <CA+c2ei8Wrr0-t4HoEU6kK_ZatSEpUZa8thWV9Rwh5Bp46w-sJg@mail.gmail.com>
To: Erik Arvidsson <arv@chromium.org>
Cc: Ojan Vafai <ojan@chromium.org>, "Tab Atkins Jr." <jackalmage@gmail.com>, Eric U <ericu@google.com>, Webapps WG <public-webapps@w3.org>
On Mon, Oct 24, 2011 at 7:49 PM, Erik Arvidsson <arv@chromium.org> wrote:
> On Mon, Oct 24, 2011 at 19:23, Jonas Sicking <jonas@sicking.cc> wrote:
>>> On the topic of getting rid of BlobBuilder, do you have thoughts on losing
>>> the ability to back it by an on-disk file?
>>
>> I'm not sure I understand the problem. A Blob can also be backed by a
>> on-disk file.
>>
>> Could you elaborate?
>
> I think the point is that with the old one you could generate lots of
> data, add that to the blob, generate a lot more data and add that to
> the blob. After every add it might be safe to gc that data. With this
> proposal all that data needs to be in memory at the point of
> construction.
>
> Could we add a concat like method to Blob that returns a new "larger" blob?
>
> var bb = new BlobBuilder();
> bb.append(data);
> bb.append(moreData);
> var b = bb.getBlob();
>
> var b = new Blob();
> b = b.concat(data);
> b = b.concat(moreData);

Sure. Though you could also just do

var b = new Blob();
b = new Blob([b, data]);
b = new Blob([b, moreData]);

I don't really have a strong preference for we should have .concat as
well or not. Array and String both have a lot of redundant methods for
concatenating and splitting data.

/ Jonas
Received on Tuesday, 25 October 2011 02:55:05 GMT

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