/** How many bytes a reader reads from the file at a time. */ export declare const READ_CHUNK_BYTES: number; export type LineSplitter = { /** The complete lines finished by `chunk`. The bytes after the last * newline are kept as the partial line, for a later push to complete. */ push(chunk: Buffer): string[]; /** For a source that has ended: the partial last line as one more batch of * lines. See `finishedTail`. */ finish(): string[]; /** How many bytes the partial line holds. */ pendingBytes(): number; /** Forget the partial line. */ reset(): void; }; export declare function makeLineSplitter(): LineSplitter; export type LineChunk = { lines: string[]; /** True when the reader has reached the end of the file as it is now. */ atEnd: boolean; }; export type LineReader = { /** Read at most `READ_CHUNK_BYTES` and return the lines that finished. */ readChunk(): LineChunk; /** Read to the end of the file as it is now, handing over the lines that * finish one chunk at a time, so no caller holds the whole file. */ readToEnd(onLines: (lines: string[]) => void): void; /** For a finished file: the partial last line as one more batch of lines, * under the rule in `finishedTail`. The reader keeps the bytes, so a viewer * that starts following the file afterwards can still complete the line. */ finish(): string[]; /** How many bytes the partial last line holds. */ pendingBytes(): number; /** Close the file. A read that reaches the end closes it by itself, so only * a caller that stops early needs this. */ close(): void; }; /** * A reader of a file that may still be growing. Each read picks up where the * last one stopped, and the file stays open from one read to the next until a * read reaches the end. `startOffset` is where reading begins: 0 reads the * whole file; `currentFileSize(path)` reads only what is appended later. A * missing file reads as empty. A file that shrank (rotated or truncated) * rewinds to the start, and that read returns no lines. */ export declare function makeLineReader(path: string, startOffset?: number): LineReader; /** The file's size right now; 0 when it does not exist yet. */ export declare function currentFileSize(path: string): number;