/** * Ported from https://github.com/mafintosh/end-of-stream with permission from the author, * Mathias Buus (@mafintosh). * @module */ import type { FinishedOptions } from 'node:stream'; export type FinishedCallback = (this: unknown, err?: Error | null) => void; /** * Calls `callback` when `stream` is no longer readable, writable, or has errored. * Returns a function that detaches the listeners. */ export declare function eos(stream: unknown, callback: FinishedCallback): () => void; export declare function eos(stream: unknown, options: FinishedOptions | null | undefined, callback: FinishedCallback): () => void; export interface FinishedPromiseOptions extends FinishedOptions { /** Detach the listeners once the promise settles. */ cleanup?: boolean; } /** Promise form of {@link eos}. */ export declare function finished(stream: unknown, opts?: FinishedPromiseOptions | null): Promise;