Class

FileReader (upload)

@ckeditor/ckeditor5-upload/src/filereader

class

Wrapper over the native FileReader.

Filtering

Properties

  • data : File | undefined

    Holds the data of an already loaded file. The file must be first loaded by using read().

  • 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.<String>

    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 )

    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.