Class FileAbstract

Hierarchy (view full)

Constructors

Properties

path: string

The path to the file

position: number

Get the current file position.

Methods

  • Returns Promise<void>

  • Internal

    Set the file type

    Parameters

    Returns Promise<void>

  • Asynchronous fchmod.

    Parameters

    • mode: number

    Returns Promise<void>

  • Synchronous fchmod.

    Parameters

    • mode: number

    Returns void

  • Asynchronous chown.

    Parameters

    • uid: number
    • gid: number

    Returns Promise<void>

  • Synchronous chown.

    Parameters

    • uid: number
    • gid: number

    Returns void

  • Asynchronous close.

    Returns Promise<void>

  • Asynchronous datasync.

    Default implementation maps to sync.

    Returns Promise<void>

  • Synchronous datasync.

    Default implementation maps to syncSync.

    Returns void

  • Read data from the file.

    Type Parameters

    • TBuffer extends ArrayBufferView

    Parameters

    • buffer: TBuffer

      The buffer that the data will be written to.

    • Optional offset: number

      The offset within the buffer where writing will start.

    • Optional length: number

      An integer specifying the number of bytes to read.

    • Optional position: number

      An integer specifying where to begin reading from in the file. If position is null, data will be read from the current file position.

    Returns Promise<FileReadResult<TBuffer>>

    Promise resolving to the new length of the buffer

  • Read data from the file.

    Parameters

    • buffer: ArrayBufferView

      The buffer that the data will be written to.

    • Optional offset: number

      The offset within the buffer where writing will start.

    • Optional length: number

      An integer specifying the number of bytes to read.

    • Optional position: number

      An integer specifying where to begin reading from in the file. If position is null, data will be read from the current file position.

    Returns number

  • Asynchronous sync.

    Returns Promise<void>

  • Asynchronous truncate.

    Parameters

    • len: number

    Returns Promise<void>

  • Synchronous truncate.

    Parameters

    • len: number

    Returns void

  • Change the file timestamps of the file.

    Parameters

    • atime: Date
    • mtime: Date

    Returns Promise<void>

  • Change the file timestamps of the file.

    Parameters

    • atime: Date
    • mtime: Date

    Returns 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

      Uint8Array containing the data to write to the file.

    • Optional offset: number

      Offset in the buffer to start reading data from.

    • Optional length: number

      The amount of bytes to write to the file.

    • Optional position: number

      Offset from the beginning of the file where this data should be written. If position is null, the data will be written at the current position.

    Returns Promise<number>

    Promise resolving to the new length of the buffer

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

    Parameters

    • buffer: Uint8Array

      Uint8Array containing the data to write to the file.

    • Optional offset: number

      Offset in the buffer to start reading data from.

    • Optional length: number

      The amount of bytes to write to the file.

    • Optional position: number

      Offset from the beginning of the file where this data should be written. If position is null, the data will be written at the current position.

    Returns number