@kayahr/wastelib
    Preparing search index...

    Interface FileHandleLike

    Minimal FileHandle interface for random read access to a file. In Node.js a standard file handle already fulfills this contract. In Browsers it might be needed to read the whole file into memory and then write a simple implementation of this interface to copy the corresponding data to the given output buffer.

    interface FileHandleLike {
        read(
            buffer: Uint8Array,
            offset: number,
            length: number,
            position: number,
        ): Promise<FileReadResultLike>;
    }
    Index

    Methods

    Methods

    • Reads bytes from file and copies them into the given output buffer.

      Parameters

      • buffer: Uint8Array

        The output buffer to fill.

      • offset: number

        Offset with the output buffer to start filling.

      • length: number

        The number of bytes to read into the output buffer.

      • position: number

        The position within the file to start reading at.

      Returns Promise<FileReadResultLike>

      The file read result.