JavaScriptFile API, Blobs and FileReaders


  • reader = new FileReader();


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.