@opfs.js/core
    Preparing search index...

    Class FileRW

    Read-write file handle. Extends FileRO with write and truncate capabilities.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    fullPath: string

    Methods

    • Flush pending writes to the file.

      Returns Promise<void>

    • Read data from the file.

      Parameters

      • size: number | BufferSource

        Number of bytes or a preallocated buffer.

      • Optionaloptions: { at?: number }

        Optional at offset to read from.

      Returns Promise<ArrayBuffer>

      A Promise resolving to an ArrayBuffer of read data.

    • Truncate the file to a specified size.

      Parameters

      • newSize: number

        New size of the file in bytes.

      Returns Promise<void>

    • Write data to the file.

      Parameters

      • data: string | BufferSource

        String or buffer to write.

      • Optionaloptions: { at?: number }

        Optional at offset to write at.

      Returns Promise<number>

      Number of bytes written.