The FileReader object lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read.
- Companion:
- object
Value members
Concrete methods
Aborts the read operation. Upon return, the readyState will be DONE.
Aborts the read operation. Upon return, the readyState will be DONE.
A DOMException representing the error that occurred while reading the file.
A DOMException representing the error that occurred while reading the file.
The readAsArrayBuffer method is used to starts reading the contents of the specified Blob or File. When the read operation is finished, the readyState becomes DONE, and the loadend is triggered. At that time, the result attribute contains an ArrayBuffer representing the file's data.
The readAsArrayBuffer method is used to starts reading the contents of the specified Blob or File. When the read operation is finished, the readyState becomes DONE, and the loadend is triggered. At that time, the result attribute contains an ArrayBuffer representing the file's data.
The readAsDataURL method is used to starts reading the contents of the specified Blob or File. When the read operation is finished, the readyState becomes DONE, and the loadend is triggered. At that time, the result attribute contains a data: URL representing the file's data as base64 encoded string.
The readAsDataURL method is used to starts reading the contents of the specified Blob or File. When the read operation is finished, the readyState becomes DONE, and the loadend is triggered. At that time, the result attribute contains a data: URL representing the file's data as base64 encoded string.
The readAsText method is used to read the contents of the specified Blob or File. When the read operation is complete, the readyState is changed to DONE, the loadend is triggered, and the result attribute contains the contents of the file as a text string.
The readAsText method is used to read the contents of the specified Blob or File. When the read operation is complete, the readyState is changed to DONE, the loadend is triggered, and the result attribute contains the contents of the file as a text string.
A number indicating the state of the FileReader. This will be one of the State constants. EMPTY : 0 : No data has been loaded yet. LOADING : 1 : Data is currently being loaded. DONE : 2 : The entire read request has been completed.
A number indicating the state of the FileReader. This will be one of the State constants. EMPTY : 0 : No data has been loaded yet. LOADING : 1 : Data is currently being loaded. DONE : 2 : The entire read request has been completed.
The file's contents. This property is only valid after the read operation is complete, and the format of the data depends on which of the methods was used to initiate the read operation.
The file's contents. This property is only valid after the read operation is complete, and the format of the data depends on which of the methods was used to initiate the read operation.
Inherited methods
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).
This implementation accepts a settings object of type EventListenerOptions.
- Inherited from:
- EventTarget
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).
- Inherited from:
- EventTarget
Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().
Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().
- Inherited from:
- EventTarget
Removes the event listener previously registered with EventTarget.addEventListener.
Removes the event listener previously registered with EventTarget.addEventListener.
This implementation accepts a settings object of type EventListenerOptions.
- Inherited from:
- EventTarget
Removes the event listener previously registered with EventTarget.addEventListener.
Removes the event listener previously registered with EventTarget.addEventListener.
- Inherited from:
- EventTarget
Concrete fields
A handler for the abort event. This event is triggered each time the reading operation is aborted.
A handler for the abort event. This event is triggered each time the reading operation is aborted.
A handler for the error event. This event is triggered each time the reading operation encounter an error.
A handler for the error event. This event is triggered each time the reading operation encounter an error.
A handler for the load event. This event is triggered each time the reading operation is successfully completed.
A handler for the load event. This event is triggered each time the reading operation is successfully completed.
A handler for the loadend event. This event is triggered each time the reading operation is completed (either in success or failure).
A handler for the loadend event. This event is triggered each time the reading operation is completed (either in success or failure).
A handler for the loadstart event. This event is triggered each time the reading is starting.
A handler for the loadstart event. This event is triggered each time the reading is starting.