W3C home > Mailing lists > Public > public-webcrypto@w3.org > September 2012

Re: JS code examples for ACTION 43

From: Arun Ranganathan <arun@mozilla.com>
Date: Thu, 6 Sep 2012 13:36:35 -0400
Cc: David Dahl <ddahl@mozilla.com>, "public-webcrypto@w3.org Working Group" <public-webcrypto@w3.org>
Message-Id: <15FDB88E-3512-4B8E-AE24-6FC08F6DEFE5@mozilla.com>
To: Ryan Sleevi <sleevi@google.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 6 September 2012 17:37:07 GMT