JavaScript File API, Blobs and FileReaders

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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



Got any JavaScript Question?