W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

[FileAPI] BlobBuilder.getBlob should clear the BlobBuilder

From: Kyle Huey <me@kylehuey.com>
Date: Tue, 12 Apr 2011 15:38:10 -0700
Message-ID: <BANLkTi=VDEfkJrfbq-D0vaSxn19nA9VmyA@mail.gmail.com>
To: Web Applications Working Group WG <public-webapps@w3.org>
Hello All,

In the current FileAPI Writer spec a BlobBuilder can be used to build a
series of blobs like so:

  var bb = BlobBuilder();
  bb.append("foo");
  var foo = bb.getBlob();
  bb.append("bar");
  var bar = bb.getBlob();
  foo.size; // == 3
  bar.size; // == 6

My concern with this pattern is that it seems that one of the primary use
cases is to keep a BlobBuilder around for a while to build up a blob over
time.  A BlobBuilder left around could potentially entrain large amounts of
memory.  I propose that BlobBuilder.getBlob() "clears" the BlobBuilder,
returning it to an empty state.  The current behavior also doesn't seem
terribly useful to me (though I'm happy to be convinced otherwise) and be
easily replicated on top of the proposed behavior (immediately reappending
the Blob that was just retrieved.)

Thoughts/comments?

- Kyle
Received on Wednesday, 13 April 2011 00:25:32 GMT

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