Class FetchFS

A simple filesystem backed by HTTP using the fetch API.

Index objects look like the following:

{
"version": 1,
"entries": {
"/home": { ... },
"/home/john": { ... },
"/home/james": { ... }
}
}

Each entry contains the stats associated with the file.

Hierarchy (View Summary)

Constructors

Properties

_disableSync?: boolean

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

_initialized: boolean = false
baseUrl: string = ''
requestInit?: RequestInit
store: Store

Methods

  • 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.

  • Test whether or not path exists.

    Parameters

    • path: string

    Returns Promise<boolean>

  • 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