• Converts a ReadableStream into a callback pattern.

    Parameters

    • stream: AsyncIterable<any> | ReadableStream<Uint8Array>

      The input ReadableStream.

    • onChunk: ((arr: Uint8Array, flush?: boolean) => void)

      A function that will be called on each new byte chunk in the stream.

        • (arr, flush?): void
        • Parameters

          • arr: Uint8Array
          • Optionalflush: boolean

          Returns void

    Returns Promise<void>

    A promise that will be resolved when the stream closes.