ZenFS
    Preparing search index...

    Class HandleInternal

    Index

    Constructors

    • Creates a file with path and, optionally, the given contents. Note that, if contents is specified, it will be mutated by the file.

      Parameters

      Returns Handle

    Properties

    _buffer?: Uint8Array<ArrayBufferLike>
    _position: number = 0

    Current position

    closed: boolean = false

    Whether the file is open or closed

    context: V_Context
    dirty: boolean = false

    Whether the file has changes which have not been written to the FS

    flag: number
    inode: InodeLike
    internalPath: string
    path: string

    Accessors

    • get position(): number

      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

      The current file position.

    • set position(value: number): void

      Parameters

      • value: number

      Returns void

    Methods

    • Parameters

      • mode: number

      Returns Promise<void>

    • Parameters

      • uid: number
      • gid: number

      Returns Promise<void>

    • Parameters

      • uid: number
      • gid: number

      Returns void

    • Default implementation maps to sync.

      Returns Promise<void>

    • Default implementation maps to syncSync.

      Returns void

    • Cleans up. This will not sync the file data to the FS

      Parameters

      • Optionalforce: boolean

      Returns void

    • Cleans up. This will not sync the file data to the FS

      Parameters

      • Optionalforce: boolean

      Returns void

    • Read data from the file.

      Parameters

      • buffer: ArrayBufferView

        The buffer that the data will be written to.

      • offset: number = 0

        The offset within the buffer where writing will start.

      • length: number = ...

        An integer specifying the number of bytes to read.

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

      number of bytes written

    • Read data from the file.

      Parameters

      • buffer: ArrayBufferView

        The buffer that the data will be written to.

      • offset: number = 0

        The offset within the buffer where writing will start.

      • length: number = ...

        An integer specifying the number of bytes to read.

      • 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

      number of bytes written

    • Parameters

      • length: number

      Returns Promise<void>

    • Parameters

      • length: number

      Returns void

    • Change the file timestamps of the file.

      Parameters

      • atime: number
      • mtime: number

      Returns Promise<void>

    • Change the file timestamps of the file.

      Parameters

      • atime: number
      • mtime: number

      Returns void

    • Write buffer to the file.

      Parameters

      • buffer: Uint8Array

        Uint8Array containing the data to write to the file.

      • offset: number = 0

        Offset in the buffer to start reading data from.

      • length: number = ...

        The amount of bytes to write to the file.

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

      bytes written

    • Write buffer to the file.

      Parameters

      • buffer: Uint8Array

        Uint8Array containing the data to write to the file.

      • offset: number = 0

        Offset in the buffer to start reading data from.

      • length: number = ...

        The amount of bytes to write to the file.

      • 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

      bytes written