Class AsyncKeyValueFileSystem

An "Asynchronous key-value file system". Stores data to/retrieves data from an underlying asynchronous key-value store.

Hierarchy

Constructors

Properties

_cache: LRUCache = null
_ready: Promise<AsyncKeyValueFileSystem> = ...
Name: string = ...

Accessors

Methods

  • Helper function for findINode.

    Parameters

    • tx: AsyncKeyValueROTransaction
    • parent: string

      The parent directory of the file we are attempting to find.

    • filename: string

      The filename of the inode we are attempting to find, minus the parent.

    • visited: Set<string> = ...

    Returns Promise<string>

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

    Parameters

    Returns Promise<string>

  • Asynchronously append data to a file, creating the file if it not yet exists.

    Parameters

    • fname: string
    • data: Uint8Array
    • flag: FileFlag
    • mode: number
    • cred: Cred

    Returns Promise<void>

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

    Parameters

    • tx: AsyncKeyValueRWTransaction
    • p: string

      The path to the new file.

    • type: FileType

      The type of the new file.

    • mode: number

      The mode to create the new file with.

    • cred: Cred

      The UID/GID to create the file with

    • data: Uint8Array

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

    Returns Promise<default>

  • Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false.

    Parameters

    • p: string
    • cred: Cred

    Returns Promise<boolean>

  • Given the Inode of a directory, retrieves the corresponding directory listing.

    Parameters

    Returns Promise<{
        [fileName: string]: string;
    }>

  • Given the ID of a node, retrieves the corresponding Inode.

    Parameters

    • tx: AsyncKeyValueROTransaction

      The transaction to use.

    • p: string

      The corresponding path to the file (used for error messages).

    • id: string

      The ID to look up.

    Returns Promise<default>

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

    Returns Promise<void>

  • Asynchronous mkdir.

    Parameters

    • p: string
    • mode: number

      Mode to make the directory using. Can be ignored if the filesystem doesn't support permissions.

    • cred: Cred

    Returns Promise<void>

  • Synchronous mkdir.

    Parameters

    • p: string
    • mode: number

      Mode to make the directory using. Can be ignored if the filesystem doesn't support permissions.

    • cred: Cred

    Returns void

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

    Parameters

    • p: string

      The path to open.

    • flag: FileFlag

      The flag to use when opening the file.

    • cred: Cred

    Returns File

    A File object corresponding to the opened file.

  • Asynchronous readdir. Reads the contents of a directory.

    The callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding '.' and '..'.

    Parameters

    • p: string
    • cred: Cred

    Returns Promise<string[]>

  • Asynchronous realpath. The callback gets two arguments (err, resolvedPath).

    Note that the Node API will resolve path to an absolute path.

    Parameters

    • p: string
    • cred: Cred

    Returns Promise<string>

  • Remove all traces of the given path from the file system.

    Parameters

    • p: string

      The path to remove from the file system.

    • isDir: boolean

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

    • cred: Cred

    Returns Promise<void>

    Todo

    Update mtime.

  • Asynchronous symlink.

    Parameters

    • srcpath: string
    • dstpath: string
    • type: string

      can be either 'dir' or 'file'

    • cred: Cred

    Returns Promise<void>

  • Synchronous symlink.

    Parameters

    • srcpath: string
    • dstpath: string
    • type: string

      can be either 'dir' or 'file'

    • cred: Cred

    Returns void

  • Change file timestamps of the file referenced by the supplied path.

    Parameters

    • p: string
    • atime: Date
    • mtime: Date
    • cred: Cred

    Returns Promise<void>

  • Change file timestamps of the file referenced by the supplied path.

    Parameters

    • p: string
    • atime: Date
    • mtime: Date
    • cred: Cred

    Returns void

  • Asynchronously writes data to a file, replacing the file if it already exists.

    The encoding option is ignored if data is a buffer.

    Parameters

    • fname: string
    • data: Uint8Array
    • flag: FileFlag
    • mode: number
    • cred: Cred

    Returns Promise<void>

  • Synchronously writes data to a file, replacing the file if it already exists.

    The encoding option is ignored if data is a buffer.

    Parameters

    • fname: string
    • data: Uint8Array
    • flag: FileFlag
    • mode: number
    • cred: Cred

    Returns void

Generated using TypeDoc