///
import { Writable } from 'node:stream';
import { Parser, type ParserOptions, type TreeAdapterTypeMap, type DefaultTreeAdapterMap } from 'parse5';
/**
* Streaming HTML parser with scripting support.
* A [writable stream](https://nodejs.org/api/stream.html#stream_class_stream_writable).
*
* @example
*
* ```js
* const ParserStream = require('parse5-parser-stream');
* const http = require('http');
* const { finished } = require('node:stream');
*
* // Fetch the page content and obtain it's
node
* http.get('http://inikulin.github.io/parse5/', res => {
* const parser = new ParserStream();
*
* finished(parser, () => {
* console.log(parser.document.childNodes[1].childNodes[0].tagName); //> 'head'
* });
*
* res.pipe(parser);
* });
* ```
*
*/
export declare class ParserStream extends Writable {
parser: Parser;
static getFragmentStream(fragmentContext?: T['parentNode'] | null, options?: ParserOptions): ParserStream;
private lastChunkWritten;
private writeCallback;
private pendingHtmlInsertions;
/** The resulting document node. */
get document(): T['document'];
getFragment(): T['documentFragment'];
/**
* @param options Parsing options.
*/
constructor(options?: ParserOptions, parser?: Parser);
_write(chunk: string, _encoding: string, callback: () => void): void;
end(chunk?: any, encoding?: any, callback?: any): any;
}
export interface ParserStream {
/**
* Raised when parser encounters a `');
* ```
*
* @param event Name of the event
* @param handler
*/
on(event: 'script', handler: (scriptElement: T['element'], documentWrite: (html: string) => void, resume: () => void) => void): void;
/**
* Base event handler.
*
* @param event Name of the event
* @param handler Event handler
*/
on(event: string, handler: (...args: any[]) => void): this;
}
//# sourceMappingURL=index.d.ts.map