[FileAPI] BlobBuilder.getBlob should clear the BlobBuilder

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 UTC