Re: Is BlobBuilder needed?

On Thu, Oct 27, 2011 at 11:51 AM, ATSUSHI TAKAYAMA <
taka.atsushi@googlemail.com> wrote:

> So converting Blob to ArrayBuffer is only supported through an
> asynchronous API (FileReader's readAsArrayBuffer) except in Workers,
> but the other way round is synchronous? I thought the direction of the
> client side web was to make all API's that might involve disk access
> asynchronous.
>

Creating a Blob can be synchronous because it doesn't actually (visibly)
copy or move any data around--that doesn't happen until you actually try to
do something with the data, and all APIs to do *that* are async.

Even if an implementation needs to hit the disk to make a Blob out of an
ArrayBuffer for some reason, it doesn't have to wait for that to complete
before returning the Blob.  It can just return the Blob and complete the
copy asynchronously, since it already knows everything it needs to about the
Blob (its size) in order to return it.

-- 
Glenn Maynard

Received on Thursday, 27 October 2011 16:31:03 UTC