File API, Blobs and FileReaders

Download javascript eBook

Syntax

  • reader = new FileReader();

Parameters

Property/MethodDescription
errorA error that occurred while reading the file.
readyStateContains the current state of the FileReader.
resultContains the file contents.
onabortTriggered when the operation is aborted.
onerrorTriggered when an error is encountered.
onloadTriggered when the file has loaded.
onloadstartTriggered when the file loading operation has started.
onloadendTriggered when the file loading operation has ended.
onprogressTriggered whilst reading a Blob.
abort()Aborts the current operation.
readAsArrayBuffer(blob)Starts reading the file as an ArrayBuffer.
readAsDataURL(blob)Starts reading the file as a data url/uri.
readAsText(blob[, encoding])Starts reading the file as a text file. Not able to read binary files. Use readAsArrayBuffer instead.

Remarks

https://www.w3.org/TR/FileAPI/

Related Examples

Stats

153 Contributors: 10
Friday, February 17, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook