/// <reference types="node" />
import { Readable } from 'stream';
/**
 * Allows async line-wise reading from a stream.
 */
export declare class AsyncLineReader {
    private stream;
    private separator;
    private bufferEncoding;
    private internalBuffer;
    private ended;
    private error;
    private resolve;
    private reject;
    /**
     * Creates a new AsyncLineReader instance.
     * @param stream The stream to read from.
     * @param separator The line separator.
     * @param bufferEncoding The encoding of the buffer, if the stream is a binary stream.
     */
    constructor(stream: Readable, separator?: string, bufferEncoding?: BufferEncoding);
    /**
     * Checks the type of a chunk and converts it to a string.
     */
    private chunkToString;
    /**
     * Called on stream error.
     */
    private onError;
    /**
     * Called on stream end.
     */
    private onEnd;
    /**
     * Called in case there is new data in the stream.
     */
    private onData;
    /**
     * Notifies a waiting promise chain, if any.
     */
    private tryNotifyWaiting;
    /**
     * Either rejects a waiting promise with the given error,
     * or stores it for later throwing.
     */
    private consumeError;
    /**
     * Gets the next available line from the buffer. The line is removed from the buffer.
     *
     * Returns null when there is no data, regardless of the stream has ended or not.
     */
    private readNextLineFromBuffer;
    /**
     * Gets the next line from the stream.
     * Returns either a line, a promise that resolves
     * when the next line becomes available, or null,
     * if the stream has ended and was read completely.
     * This method throws if the underlying stream errors.
     */
    readLine(): Promise<string>;
}
