Lurch web app user interface

Class

BrowserFileSystem

A subclass of FileSystem that represents a flat file system in the browser's localStorage object. It implements all the abstract methods of the parent class, but specific to that one storage location.

Because it is a flat file system, the path member of file objects is not used. (In some methods below, if that member is present and is a nonempty string, then the method will fail in the way documented in that method.) Also, UIDs are not used by this file system; rather, filenames are used to identify files. UIDs are ignored in all methods of this class.

Constructor

new BrowserFileSystem()

Source

Methods

delete(fileObject) → {Promise}

See the documentation of the delete() method in the parent class for the definition of how this method must behave. It implements the requirements specified there for a flat file system in the browser's localStorage object, as defined at the documentation for this class.

Because this is a flat file system, any file object with a nonempty path member will not exist, regardless of its filename, and will therefore result in an error being thrown.

Parameters

  • fileObject Object

    as documented in the FileSystem class

Returns

Source

has(fileObject) → {Promise}

See the documentation of the has() method in the parent class for the definition of how this method must behave. It implements the requirements specified there for a flat file system in the browser's localStorage object, as defined at the documentation for this class.

Because this is a flat file system, any file object with a nonempty path member will not exist, regardless of its filename, and will therefore result in a false value being resolved from the promise.

Parameters

  • fileObject Object

    as documented in the FileSystem class

Returns

Source

list(fileObject) → {Promise}

See the documentation of the list() method in the parent class for the definition of how this method must behave. It implements the requirements specified there for a flat file system in the browser's localStorage object, as defined at the documentation for this class.

In particular, because this is a flat file system, no parameter should be passed to attempt to list files in a subfolder, since there are no subfolders. Any attempt to do so will result in an error, unless the parameter is a file object with an empty string for its path.

Parameters

  • fileObject Object

    as documented in the FileSystem class

Returns

Source

read(fileObject) → {Promise}

See the documentation of the read() method in the parent class for the definition of how this method must behave. It implements the requirements specified there for a flat file system in the browser's localStorage object, as defined at the documentation for this class.

Because this is a flat file system, any file object with a nonempty path member will not exist, regardless of its filename, and will therefore result in an error being thrown.

Parameters

  • fileObject Object

    as documented in the FileSystem class

Returns

Source

write(fileObject) → {Promise}

See the documentation of the write() method in the parent class for the definition of how this method must behave. It implements the requirements specified there for a flat file system in the browser's localStorage object, as defined at the documentation for this class.

Because this is a flat file system, any file object with a nonempty path member will not exist, regardless of its filename, and will therefore result in an error being thrown.

Parameters

  • fileObject Object

    as documented in the FileSystem class

Returns

Source