@cityjson/flatcitybuf
    Preparing search index...

    Interface RangeReader

    A random-access byte source. Implement this to point the reader at a transport the package does not ship (an S3 SDK, an OPFS handle, a test double), then hand it to FcbReader.fromReader. The contract every implementor must honour is stated in this module's own documentation.

    interface RangeReader {
        read(
            offset: number,
            length: number,
            opts?: ReadOpts,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        size(): number;
    }

    Implemented by

    Index
    • Resolves to EXACTLY length bytes starting at offset, or rejects with an FcbError. Never returns a short buffer, and never clamps a range that crosses the end of the resource. The returned array MAY be a view into a buffer the reader reuses on its next call, so a caller that needs the bytes to outlive the next read must copy them.

      Parameters

      • offset: number
      • length: number
      • Optionalopts: ReadOpts

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • The resource's total byte length. Synchronous by contract: every source learns its size when it opens (a stat, blob.size, or a Content-Range at open time), so the reader's layout arithmetic never has to await.

      Returns number