readAsArrayBuffer (File and Blob)

readAsArrayBuffer method

Reads a File, Blob, MSStream into memory as an ArrayBuffer object.

Internet Explorer 10

 

Syntax

object.readAsArrayBuffer(object, length)

Parameters

object [in]

Type: Blob, MSStream, or File

length [in, optional]

Type: number

Return value

This method does not return a value.

Remarks

When invoked from an MSStreamReader or FileReader object, this method doesn't return a value. When invoked from a FileReaderSync object, this method returns an ArrayBuffer object representing the data that was read.

var arrayBuffer = FileReaderSync.readAsArrayBuffer(blob);
FileReader.readAsArrayBuffer(blob);
MSStreamReader.readAsArrayBuffer(msstream,length);

When invoked from an MSStreamReader or FileReader object, this method asynchronously starts reading the contents of the specified File, Blob or MSStream. When the read operation completes, the readyState property is set to DONE and the onloadend event handler is fired. At that time, the result property contains an arrayBuffer object representing the data that was read.

When invoked from an MSStreamReader object, the optional length parameter specifies the number of bytes that are read from the specified MSStream object. If the length parameter isn't specified the read operation continues until the end of the MSStream object is reached.

When invoked from a FileReaderSync object, this method synchronously reads the contents of the specified File or Blob. The method will return an ArrayBuffer object representing the data that was read.

See also

FileReader
FileReaderSync
MSStreamReader

 

 

Show:
© 2016 Microsoft