haXe API Documentation
Back | Index
extern class js.html.FileReader
extends EventTarget
Available in js

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. File objects may be obtained in one of two ways: from a FileList object returned as a result of a user selecting files using the <input> element, or from a drag and drop operation's DataTransfer object.

To create a FileReader, simply do the following:

var reader = new FileReader();

See Using files from web applications for details and examples.



Documentation for this class was provided by MDN.
var error(default,null) : js.html.fs.FileError
The error that occurred while reading the file. Read only.
var onabort : EventListener
Called when the read operation is aborted.
var onerror : EventListener
Called when an error occurs.
var onload : EventListener
Called when the read operation is successfully completed.
var onloadend : EventListener
Called when the read is completed, whether successful or not. This is called after either onload or onerror.
var onloadstart : EventListener
Called when reading the data is about to begin.
var onprogress : EventListener
Called periodically while the data is being read.
var readyState(default,null) : Int
Indicates the state of the FileReader. This will be one of the State constants. Read only.
var result(default,null) : Dynamic
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. Read only.
function new() : Void
function abort() : Void
function readAsArrayBuffer(blob : Blob) : Void
function readAsBinaryString(blob : Blob) : Void
function readAsDataURL(blob : Blob) : Void
function readAsText(blob : Blob, ?encoding : String) : Void
static inline var DONE : Int
The entire read request has been completed.
static inline var EMPTY : Int
No data has been loaded yet.
static inline var LOADING : Int
Data is currently being loaded.
Back | Index