Skip to main content

Class: RangeReader

Defined in: reader.ts:66

Reads byte ranges of files over HTTP, as few streamed range requests as the reads allow. Reads issued in one task are merged per file and purpose (mergeReads); each merged range is one RangeStream that resolves every read the moment its bytes arrive and is cancelled when no read wants what is left. Everything received lands in the ByteCache, which later reads are served from; a read inside a request still in flight attaches to it instead of starting another.

Constructors​

Constructor​

new RangeReader(options?): RangeReader

Defined in: reader.ts:110

Parameters​

options?​

RangeReaderOptions = {}

Returns​

RangeReader

Properties​

cache​

readonly cache: ByteCache

Defined in: reader.ts:68

Where received spans live.


stats​

readonly stats: RangeReaderStats

Defined in: reader.ts:70

Monotonic counters for measurement.

Methods​

read()​

read(file, range, options): Promise<ReadResult>

Defined in: reader.ts:133

Read range of file. An absolute range is served from the cache, or attached to a request already in flight, or queued and merged with the other reads of this task; a suffix read, or a whole-object read (range undefined), goes out at once on its own. Rejects with the signal's reason if options.signal aborts before the bytes arrive; the request itself runs on for other reads.

Parameters​

file​

FileIdentity

range​

ReadRange | undefined

options​

ReadOptions

Returns​

Promise<ReadResult>