import type RestResponse from "./RestResponse";
/**
 * Once created, RestStream must be iterated in full, otherwise the connection
 * will remain dangling. Also, this class is where we hide the details of the
 * actual stream reading using AsyncGenerator bridge abstraction.
 *
 * RestStream can also read binary data depending on the Content-Type response
 * header and/or the charset provided there. The binary data is still returned
 * as a string, one string character per each byte. To convert it to a Buffer,
 * use something like `Buffer.from(responseText, "binary")`.
 */
export default class RestStream {
    readonly res: RestResponse;
    private _generator?;
    constructor(res: RestResponse, readerIterable: {
        [Symbol.asyncIterator]: () => AsyncGenerator<string, void>;
    });
    /**
     * Reads the prefix of the stream. Closes the connection after the read is
     * done in all cases, so safe to be used to e.g. receive a trimmed response.
     */
    consumeReturningPrefix(maxChars: number): Promise<string>;
    /**
     * Closes the connection.
     */
    close(): Promise<void>;
    /**
     * Allows to iterate over the entire stream of data. You must consume the
     * entire iterable or at least call this.close(), otherwise the connection may
     * remain open.
     */
    [Symbol.asyncIterator](): AsyncGenerator<string, void>;
}
//# sourceMappingURL=RestStream.d.ts.map