Re: BlobBuilder.append() should take ArrayBufferView in addition to ArrayBuffer

On Fri, Apr 27, 2012 at 10:57 AM, Arun Ranganathan
<aranganathan@mozilla.com> wrote:
>
> On Apr 27, 2012, at 1:28 AM, Anne van Kesteren wrote:
>
>> On Fri, 27 Apr 2012 00:13:42 +0200, Arun Ranganathan <aranganathan@mozilla.com> wrote:
>>> The constructor will switch to use ArrayBufferView in lieu of ArrayBuffer, but the read method exposed on FileReader and FileReaderSync will read files into memory as ArrayBuffers.
>>
>> Since the constructor is not widely deployed yet would it not be better to stick to ArrayBufferView exclusively, just like XMLHttpRequest.send()?
>
>
> The Blob constructor will already use ArrayBufferView.  Above, do you mean, have a method of the sort FileReader.readAsArrayBufferView or something like that?
>
> *.readAsArrayBuffer is already deployed, and it might be weird to force a view on an ArrayBuffer when read into memory.

We should not have readAsArryBufferView since there's a ton of
different types of ArrayBufferViews. Instead we should just return an
ArrayBuffer and let people construct ArrayBufferViews or DataViews
into that as they see fit.

This matches what XHR does (and intends to do) I believe.

/ Jonas

Received on Saturday, 28 April 2012 08:46:47 UTC