NovaOS Development Documentation

Namespace

fs

Summary

A file system utility object for performing read, write, delete, erase, list, and make directory operations on either OPFS (Origin Private File System) or IDBFS (IndexedDB File System).

A file system utility object for performing read, write, delete, erase, list, and make directory operations on either OPFS (Origin Private File System) or IDBFS (IndexedDB File System).

Methods

static

del(path, filesystemopt) → {Promise.<any>}

Deletes a file at the specified path in the chosen filesystem.

Parameters

  • path string

    The path of the file to delete.

  • filesystem string <optional>
    "opfs"

    The filesystem to use ("opfs" or "idbfs").

Returns

  • Promise.<any>

    A promise that resolves when the delete operation is complete.

Source

static

erase(filesystemopt) → {Promise.<any>}

Erases the entire filesystem.

Parameters

  • filesystem string <optional>
    "idbfs"

    The filesystem to erase ("opfs" or "idbfs").

Returns

  • Promise.<any>

    A promise that resolves when the erase operation is complete.

Source

static

ls(path, filesystemopt) → {Promise.<any>}

Lists the contents of a directory at the specified path in the chosen filesystem.

Parameters

  • path string

    The path of the directory to list.

  • filesystem string <optional>
    "opfs"

    The filesystem to use ("opfs" or "idbfs").

Returns

  • Promise.<any>

    A promise that resolves with the contents of the directory.

Source

static

mkdir(path, filesystemopt) → {Promise.<any>}

Creates a directory at the specified path in the chosen filesystem.

Parameters

  • path string

    The path of the directory to create.

  • filesystem string <optional>
    "opfs"

    The filesystem to use ("opfs" or "idbfs").

Returns

  • Promise.<any>

    A promise that resolves when the directory is created.

Source

static

read(path, filesystemopt) → {Promise.<any>}

Reads a file from the specified path in the chosen filesystem.

Parameters

  • path string

    The path of the file to read.

  • filesystem string <optional>
    "opfs"

    The filesystem to use ("opfs" or "idbfs").

Returns

  • Promise.<any>

    A promise that resolves with the file's content.

Source

static

write(path, data, filesystemopt) → {Promise.<any>}

Writes data to a file at the specified path in the chosen filesystem.

Parameters

  • path string

    The path of the file to write.

  • data any

    The data to write to the file.

  • filesystem string <optional>
    "opfs"

    The filesystem to use ("opfs" or "idbfs").

Returns

  • Promise.<any>

    A promise that resolves when the write operation is complete.

Source