import { Readable } from 'stream'; /** Bytes kept on disk ahead of the last position requested by the view. */ export declare const SPOOL_READ_AHEAD: number; export interface SpoolEvent { size: number; ended: boolean; settled: boolean; error: Error | null; } /** * A non-seekable stream made seekable in a private temporary file. * * Only the first chunk is consumed eagerly. Afterwards the file-backed * session advances an absolute target and the input remains paused once that * target is reached, so an upstream `cat` blocks close to the current view. */ export declare class PipeSpool { readonly directory: string; readonly path: string; private readonly stream; private fd; private target; private draining; private closed; private started; private finishResolve; private startResolve; private readonly listeners; size: number; ended: boolean; error: Error | null; private constructor(); /** Creates the spool after capturing at most the stream's first chunk. */ static create(stream: Readable): Promise; private start; private readonly onData; private readonly onEnd; private readonly onError; private finish; private emit; private snapshot; /** Allows input through `position`, leaving the upstream paused afterward. */ requestThrough(position: number): void; /** Reads until true end-of-input, used only by commands such as G and %. */ drain(): void; /** Stops an explicit drain immediately at the bytes already received. */ cancelDrain(): void; /** Resolves when the producer ends or errors. */ waitForEnd(): Promise; /** Resolves when the current bounded request pauses or reaches EOF. */ waitForSettled(): Promise; subscribe(listener: (event: SpoolEvent) => void): () => void; /** Stops the producer and removes the private spool directory. */ close(): void; }