import { Uint8ArrayList } from 'uint8arraylist'; import type { Source } from 'it-stream-types'; /** * A specialized `AsyncGenerator` that lets you pass a number to the `.next` method which * will attempt to return only that many bytes. */ export interface Reader extends AsyncGenerator { next: (...args: [] | [number | undefined]) => Promise>; } /** * Returns an `AsyncGenerator` that allows reading a set number of bytes from the passed source. * * @example * * ```javascript * import { reader } from 'it-reader' * * const stream = reader(source) * * // read 10 bytes from the stream * const { done, value } = await stream.next(10) * * if (done === true) { * // stream finished * } * * if (value != null) { * // do something with value * } * ``` */ export declare function reader(source: Source): Reader; //# sourceMappingURL=index.d.ts.map