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.
Optionalopts: ReadOptsThe 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.
StaticopenOpens 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.
Optionalopts: FetchRangeReaderOpts
RangeReader over HTTP
Rangerequests, built on the platformfetch. Used byFcbReader.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 ignoresRangeand answers200with the whole body is rejected (RangeNotSupported) rather than silently mis-read, and a cross-origin206whoseContent-RangeCORS 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 (asFcbReader.fromUrldoes) before scanning features, or every feature costs two HTTP requests.