An object that can generate chunks.

interface ChunkSource {
    close?: () => void;
    getChunk?: (i: number) => Promise<undefined | Chunk>;
    listChunks: () => AsyncIterable<Chunk, any, any>;
}

Implemented by

Properties

close?: () => void
getChunk?: (i: number) => Promise<undefined | Chunk>

Generate a chunk on-demand.

Type declaration

    • (i: number): Promise<undefined | Chunk>
    • Parameters

      • i: number

        Chunk number, starting from zero.

      Returns Promise<undefined | Chunk>

      Promise that resolves to requested chunk, or undefined if out of range.

listChunks: () => AsyncIterable<Chunk, any, any>

Generate chunks sequentially.

Type declaration

    • (): AsyncIterable<Chunk, any, any>
    • Returns AsyncIterable<Chunk, any, any>

      AsyncIterable of chunks in order.