import fs from 'node:fs';
import readline from 'node:readline';

declare class LineReader {
    /**
     * Creates a readline interface for reading a file.
     *
     * @param {fs.PathLike} path - The path of the file to read.
     * @param {BufferEncoding} [encoding=utf8] - The encoding of the file. Defaults to "utf8".
     * @return {readline.Interface} The readline interface for reading the file.
     */
    static createReadLineInterface(path: fs.PathLike, encoding?: BufferEncoding): readline.Interface;
    /**
     * Creates a LineReader object for reading lines from a file.
     *
     * @param {fs.PathLike} path - The path of the file to read.
     * @param {BufferEncoding} encoding - The encoding to use when reading the file. Default is "utf8".
     * @return {Object} An object with methods for reading lines from the file.
     *   - `hasNextLine`: A function that returns `true` if there is another line to read, `false` otherwise.
     *   - `nextLine`: An async function that reads the next line from the file and returns it.
     *   - `close`: A function that closes the LineReader and stops reading lines from the file.
     */
    static create(path: fs.PathLike, encoding?: BufferEncoding): {
        hasNextLine: () => boolean;
        nextLine: <Output>(fn?: ((value: string) => Output) | undefined) => Promise<string | Output | undefined>;
        /** Manually closes the LineReader by calling the `close` method */
        close: () => void;
    };
}

export { LineReader };
