docs.rodeo

MDN Web Docs mirror

FileReader: readAsArrayBuffer() method

{{APIRef("File API")}} {{AvailableInWorkers}} 

The readAsArrayBuffer() method of the {{domxref("FileReader")}}  interface is used to start reading the contents of a specified {{domxref("Blob")}}  or {{domxref("File")}} . When the read operation is finished, the {{domxref("FileReader.readyState","readyState")}}  property becomes DONE, and the {{domxref("FileReader/loadend_event", "loadend")}}  event is triggered. At that time, the {{domxref("FileReader.result","result")}}  property contains an {{jsxref("ArrayBuffer")}}  representing the file’s data.

[!NOTE] The {{domxref("Blob.arrayBuffer()")}}  method is a newer promise-based API to read a file as an array buffer.

Syntax

readAsArrayBuffer(blob)

Parameters

Return value

None ({{jsxref("undefined")}} ).

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN