FileReader (upload)
@ckeditor/ckeditor5-upload/src/filereader
Wrapper over the native FileReader
.
Filtering
Properties
-
data : File | undefined
module:upload/filereader~FileReader#data
Holds the data of an already loaded file. The file must be first loaded by using
read()
. -
error
module:upload/filereader~FileReader#error
Returns error that occurred during file reading.
-
loaded : Number
module:upload/filereader~FileReader#loaded
readonly observable
Number of bytes loaded.
-
_reader : FileReader
module:upload/filereader~FileReader#_reader
private
Instance of native FileReader.
Methods
-
constructor()
module:upload/filereader~FileReader#constructor
Creates an instance of the FileReader.
-
abort()
module:upload/filereader~FileReader#abort
Aborts file reader.
-
read( file ) → Promise.<String>
module:upload/filereader~FileReader#read
Reads the provided file.
Parameters
file : File
Native File object.
Returns
Promise.<String>
Returns a promise that will be resolved with file's content. The promise will be rejected in case of an error or when the reading process is aborted.
Events
-
change:loaded( eventInfo, name, value, oldValue )
module:upload/filereader~FileReader#event:change:loaded
Fired when the
loaded
property changed value.Parameters
eventInfo : EventInfo
An object containing information about the fired event.
name : String
Name of the changed property (
loaded
).value : Number
New value of the
loaded
property with given key ornull
, if operation should remove property.oldValue : Number
Old value of the
loaded
property with given key ornull
, if property was not set before.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.