Report an issue
Class

FileReader (upload)

@ckeditor/ckeditor5-upload/src/filereader

class

FileReader class - wrapper over native FileReader.

Filtering

Properties

  • error

    Returns error that occurred during file reading.

  • loaded : Number

    readonly observable

    Number of bytes loaded.

  • _reader : FileReader

    private

    Instance of native FileReader.

Methods

  • constructor()

    Creates an instance of the FileReader.

  • abort()

    Aborts file reader.

  • read( file ) → Promise

    Reads provided file.

    Parameters

    file : File

    Native File object.

    Returns

    Promise

    Returns a promise that will resolve with file's contents. Promise can be rejected in case of error or when reading process is aborted.

Events

  • change:loaded( eventInfo, name, value, oldValue )

    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 or null, if operation should remove property.

    oldValue : Number

    Old value of the loaded property with given key or null, if property was not set before.