@cityjson/flatcitybuf
    Preparing search index...

    Class FetchRangeReader

    RangeReader over HTTP Range requests, built on the platform fetch. Used by FcbReader.fromUrl, and usable directly for a caller that wants to compose its own decorator stack.

    Range support is validated STRICTLY at open(): a server that ignores Range and answers 200 with the whole body is rejected (RangeNotSupported) rather than silently mis-read, and a cross-origin 206 whose Content-Range CORS does not expose is rejected too (RangeHeadersNotExposed) -- because without that header the response's own offset cannot be confirmed.

    Not internally buffered beyond the one window it prefetches at open(); wrap it in a BufferedRangeReader (as FcbReader.fromUrl does) before scanning features, or every feature costs two HTTP requests.

    Implements

    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

    • Opens url and learns its size from the Content-Range of a single OPEN_PREFETCH_SIZE-byte Range request -- there is no separate HEAD probe, so this one request both establishes size() (synchronous for the rest of this reader's life, per the RangeReader contract) and warms the header/index prefetch window described on prefetch above. Every one of this task's four failure modes (200, malformed Content-Range, wrong range, unexposed Content-Range) is caught right here, before a caller ever sees a reader that might be lying about its size.

      Parameters

      Returns Promise<FetchRangeReader>