readAsArrayBuffer
Summary
Returns partial Blob data representing the number of bytes currently loaded (as a fraction of the total), as an ArrayBuffer object, a fixed-length binary data buffer.
Method of apis/file/FileReaderapis/file/FileReader
Syntax
var = FileReader.readAsArrayBuffer(blob);
Parameters
blob
- Data-type
- Blob
Return Value
Returns an object of type DOM NodeDOM Node
Type: HRESULT
This method can return one of these values.
S_OK
Examples
var reader = new FileReader();
reader.onload = function(e) {
var arrayBuffer = reader.result;
}
reader.readAsArrayBuffer(file);
Notes
This method asynchronously starts reading the contents of the specified File. When the read operation is finished, readyState will become DONE and the onloadend event handler (that is, callback), if present, will be invoked. At that time, the result attribute contains an array buffer object representing the file’s data.
Related specifications
- W3C File API Specification
- W3C Working Draft
Attributions
Microsoft Developer Network: Windows Internet Explorer API reference Article