Class FileSystemAbstract

Structure for a filesystem. All ZenFS backends must extend this.

This class includes default implementations for exists and existsSync

If you are extending this class, note that every path is an absolute path and all arguments are present.

Hierarchy (view full)

Constructors

Properties

_disableSync?: boolean

Whether the sync cache should be disabled. Only affects async things.

Methods

  • Create the file at path with the given mode. Then, open it with the given flag.

    Parameters

    • path: string
    • flag: string
    • mode: number

    Returns Promise<File>

  • Create the file at path with the given mode. Then, open it with the given flag.

    Parameters

    • path: string
    • flag: string
    • mode: number

    Returns File

  • Test whether or not the given path exists.

    Parameters

    • path: string

    Returns Promise<boolean>

  • Test whether or not the given path exists.

    Parameters

    • path: string

    Returns boolean

  • Asynchronous link.

    Parameters

    • target: string
    • link: string

    Returns Promise<void>

  • Synchronous link.

    Parameters

    • target: string
    • link: string

    Returns void

  • Asynchronous mkdir.

    Parameters

    • path: string
    • mode: number

      Mode to make the directory using.

    Returns Promise<void>

  • Synchronous mkdir.

    Parameters

    • path: string
    • mode: number

      Mode to make the directory using.

    Returns void

  • Opens the file at path with the given flag. The file must exist.

    Parameters

    • path: string

      The path to open.

    • flag: string

      The flag to use when opening the file.

    Returns Promise<File>

  • Opens the file at path with the given flag. The file must exist.

    Parameters

    • path: string

      The path to open.

    • flag: string

      The flag to use when opening the file.

    Returns File

    A File object corresponding to the opened file.

  • Asynchronous readdir. Reads the contents of a directory.

    Parameters

    • path: string

    Returns Promise<string[]>

  • Synchronous readdir. Reads the contents of a directory.

    Parameters

    • path: string

    Returns string[]

  • Asynchronous rename.

    Parameters

    • oldPath: string
    • newPath: string

    Returns Promise<void>

  • Synchronous rename.

    Parameters

    • oldPath: string
    • newPath: string

    Returns void

  • Asynchronous rmdir.

    Parameters

    • path: string

    Returns Promise<void>

  • Synchronous rmdir.

    Parameters

    • path: string

    Returns void

  • Synchronize the data and stats for path asynchronously

    Parameters

    • path: string
    • data: Uint8Array
    • stats: Readonly<Stats>

    Returns Promise<void>

  • Synchronize the data and stats for path synchronously

    Parameters

    • path: string
    • data: Uint8Array
    • stats: Readonly<Stats>

    Returns void

  • Asynchronous unlink.

    Parameters

    • path: string

    Returns Promise<void>

  • Synchronous unlink.

    Parameters

    • path: string

    Returns void