Re: JS code examples for ACTION 43

Ryan,


On Sep 6, 2012, at 1:11 PM, Ryan Sleevi wrote:

> 
> Can you explain how ArrayBuffer is any easier than ArrayBufferView?
> 

Not *easier* per se, but (depending on what you're trying to do), you can obtain an ArrayBuffer from a file, without predetermining what sort of view you want to use.  Additionally, if you have a string, you can coin a Blob, and read it back as an ArrayBuffer.  Those kinds of API conveniences mean you don't have to focus on what view object to use.


> Perhaps you meant to say Blob (from the File API), since Blob has a
> constructor that can take an ArrayBufferView or DOMString.
> 
> My concern with Blob (and with ArrayBuffer w/o the View) is that they
> both seem to require that the underlying data be copied in order to
> construct/invoke, whereas ArrayBufferView is a slice of an already
> existing ArrayBuffer (or arbitrary data source, in the case of
> DataView), and thus is copy-free.


Can you flesh your concern out a bit more?  What's a "worst case scenario" that you envision?

-- A*

Received on Thursday, 6 September 2012 17:37:07 UTC