Class StoreFS<T>Internal

A file system which uses a key-value store.

We use a unique ID for each node in the file system. The root node has a fixed ID.

Introduce Node ID caching?

Check modes?

Type Parameters

Hierarchy (View Summary)

Constructors

Properties

_disableSync?: boolean

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

_initialized: boolean = false
store: T

Methods

  • Adds a new node under a random ID. Retries before giving up in the exceedingly unlikely chance that we try to reuse a random id.

    Parameters

    Returns Promise<number>

  • Creates a new node under a random ID. Retries before giving up in the exceedingly unlikely chance that we try to reuse a random id.

    Parameters

    Returns number

    The ino that the data was stored under.

  • Checks if the root directory exists. Creates it if it doesn't.

    Returns Promise<void>

  • Commits a new file (well, a FILE or a DIRECTORY) to the file system with mode. Note: This will commit the transaction.

    Parameters

    • path: string

      The path to the new file.

    • type: FileType

      The type of the new file.

    • options: PureCreationOptions
    • data: Uint8Array<ArrayBufferLike>

      The data to store at the file's data node.

    • syscall: string

    Returns Promise<Inode>

  • Commits a new file (well, a FILE or a DIRECTORY) to the file system with mode. Note: This will commit the transaction.

    Parameters

    • path: string

      The path to the new file.

    • type: FileType

      The type of the new file.

    • options: PureCreationOptions
    • data: Uint8Array<ArrayBufferLike>

      The data to store at the file's data node.

    • syscall: string

    Returns Inode

    The Inode for the new file.

  • Delete all contents stored in the file system.

    Returns Promise<void>

  • Finds the Inode of path.

    Parameters

    • tx: Transaction<Store>
    • path: string

      The path to look up.

    • syscall: string
    • visited: Set<string> = ...

    Returns Inode

    The Inode of the path p.

    memoize/cache

  • Load an index into the StoreFS. You must manually add non-directory files

    Parameters

    Returns Promise<void>

  • Reads into a buffer

    Parameters

    • path: string
    • buffer: Uint8Array<ArrayBufferLike>

      The buffer to read into. You must set the byteOffset and byteLength appropriately!

    • offset: number

      The offset into the file to start reading from

    • end: number

      The position in the file to stop reading

    Returns Promise<void>

  • Reads into a buffer

    Parameters

    • path: string
    • buffer: Uint8Array<ArrayBufferLike>

      The buffer to read into. You must set the byteOffset and byteLength appropriately!

    • offset: number

      The offset into the file to start reading from

    • end: number

      The position in the file to stop reading

    Returns void

  • Remove all traces of path from the file system.

    Parameters

    • path: string

      The path to remove from the file system.

    • isDir: boolean

      Does the path belong to a directory, or a file?

    • syscall: string

    Returns Promise<void>

    Update mtime.

  • Remove all traces of path from the file system.

    Parameters

    • path: string

      The path to remove from the file system.

    • isDir: boolean

      Does the path belong to a directory, or a file?

    • syscall: string

    Returns void

    Update mtime.

  • Parameters

    • oldPath: string
    • newPath: string

    Returns Promise<void>

    Make rename compatible with the cache.

  • Updated the inode and data node at path

    Parameters

    • path: string
    • Optionaldata: Uint8Array<ArrayBufferLike>
    • Optionalmetadata: Readonly<InodeLike>

    Returns Promise<void>

    Ensure mtime updates properly, and use that to determine if a data update is required.

  • Updated the inode and data node at path

    Parameters

    • path: string
    • Optionaldata: Uint8Array<ArrayBufferLike>
    • Optionalmetadata: Readonly<InodeLike>

    Returns void

    Ensure mtime updates properly, and use that to determine if a data update is required.

  • Writes a buffer to a file

    Parameters

    • path: string
    • data: Uint8Array<ArrayBufferLike>
    • offset: number

      The offset in the file to start writing

    Returns Promise<void>

  • Writes a buffer to a file

    Parameters

    • path: string
    • data: Uint8Array<ArrayBufferLike>
    • offset: number

      The offset in the file to start writing

    Returns void