Class NoSyncFile<T>

File class for the InMemory and XHR file systems. Doesn't sync to anything, so it works nicely for memory-only files.

Type Parameters

Hierarchy

Implements

Constructors

Properties

_buffer: Uint8Array
_dirty: boolean = false
_flag: FileFlag
_fs: T
_path: string
_pos: number = 0
_stat: Stats

Methods

  • Advance the current file position by the indicated number of positions.

    Parameters

    • delta: number

    Returns number

  • NONSTANDARD: Get the underlying buffer for this file. !!DO NOT MUTATE!! Will mess up dirty tracking.

    Returns Uint8Array

  • Get the current file position.

    We emulate the following bug mentioned in the Node documentation:

    On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

    Returns number

    [Number] The current file position.

  • Read data from the file.

    Parameters

    • buffer: Uint8Array
    • offset: number
    • length: number
    • position: number

    Returns Promise<{
        buffer: Uint8Array;
        bytesRead: number;
    }>

  • Read data from the file.

    Parameters

    • buffer: Uint8Array
    • offset: number
    • length: number
    • position: number

    Returns number

    [Number]

  • Resets the dirty bit. Should only be called after a sync has completed successfully.

    Returns void

  • Optional: Change the file timestamps of the file.

    Parameters

    • atime: Date
    • mtime: Date

    Returns Promise<void>

  • Write buffer to the file. Note that it is unsafe to use fs.write multiple times on the same file without waiting for the callback.

    Parameters

    • buffer: Uint8Array
    • offset: number
    • length: number
    • position: number

    Returns Promise<number>

  • Write buffer to the file. Note that it is unsafe to use fs.writeSync multiple times on the same file without waiting for the callback.

    Parameters

    • buffer: Uint8Array
    • offset: number
    • length: number
    • position: number

    Returns number

    [Number]

Generated using TypeDoc