Return type of fetch function.

Fetch output may be accessed in one of several formats:

  • await result resolves to the reassembled object as Uint8Array.
  • for await (const packet of result) iterates over Data packets in segment number order.
  • more formats available as methods.

Result is lazy. Fetching starts when an output format is accessed. You may only access one output format on a Result instance. Formats other than await result can be accessed only once.

interface Result {
    chunks: () => AsyncIterable<Uint8Array<ArrayBufferLike>, any, any>;
    count: number;
    pipe: (dest: WritableStreamish) => Promise<void>;
    unordered: () => AsyncIterable<Data & { segNum: number }, any, any>;
}

Hierarchy

  • PromiseLike<Uint8Array>
  • AsyncIterable<Data>
    • Result

Properties

chunks: () => AsyncIterable<Uint8Array<ArrayBufferLike>, any, any>

Iterate over payload chunks in segment number order.

count: number

Number of segments retrieved so far.

pipe: (dest: WritableStreamish) => Promise<void>

Write all chunks to the destination stream.

unordered: () => AsyncIterable<Data & { segNum: number }, any, any>

Iterate over Data packets as they arrive, not sorted in segment number order.