L.FileReader()

new FileReader()

Leaflet wrapper over FileReader Web API, making it compatible with the Leaflet event system. This class extends L.Evented.

Extends

  • L.Evented

Methods

static loadFile(optionsopt) → {L.FileReader}

Instantiates a L.FileReader object and initiates a file chooser dialog. This function simulates a click on a hidden file input element created with the given options. The read method is called with the file chosen by the user.

Parameters:
Name Type Attributes Description
options Object <optional>

Options for the file input element.

Returns:
L.FileReader -

A new instance of L.FileReader with the file to be read.

static read(fileopt, optionsopt) → {L.FileReader}

Starts reading the contents of the specified file using reader method specified in options. Note: all 'init*' event handlers expected to be already attached before this method call.

Parameters:
Name Type Attributes Description
file Blob <optional>

The file or blob to be read. Optional if already set.

options Object | string <optional>

Options for file reading. Same as in constructor.

Returns:
L.FileReader -

Returns the L.FileReader instance for chaining.