/** * The `Stream.toAsyncStreamable` protocol, which lets a `Readable` be consumed by the * `stream/iter` API as batches of `Uint8Array`. * @module */ import type { toAsyncStreamable as NodeToAsyncStreamable, toStreamable as NodeToStreamable } from 'node:stream/iter'; import type { Readable as ReadableClass } from './readable.js'; /** Sync value-to-streamable protocol: `[Symbol.for('Stream.toStreamable')]()`. */ export declare const toStreamable: typeof NodeToStreamable; /** Async value-to-streamable protocol: `[Symbol.for('Stream.toAsyncStreamable')]()`. */ export declare const toAsyncStreamable: typeof NodeToAsyncStreamable; /** Flattens a value into `Uint8Array`s, following the streamable protocols, promises and iterables. */ export declare function normalizeAsyncValue(value: unknown, allowNested?: boolean): AsyncGenerator; /** Converts a batch from an object-mode or encoded stream to `Uint8Array`s, or `null` if it produced nothing. */ export declare function normalizeBatch(raw: unknown[]): Promise; /** * Like the plain async iterator, but drains everything currently buffered into a single batch * per yield, amortizing the promise and microtask cost over several chunks. * * `normalize` is only needed for object-mode and encoded streams; byte-mode chunks are already * `Uint8Array` subclasses and are yielded as they are. */ export declare function createBatchedAsyncIterator(stream: ReadableClass, normalize: ((raw: unknown[]) => Promise) | null): AsyncGenerator;