/** Options for configuring a text decoder. */ export interface TextDecoderOptions { /** Whether to throw an exception on decoding error. */ fatal?: boolean; } /** Options for decoding a buffer. */ export interface DecodeOptions { /** Whether to decode in a streaming fashion, that is, wait until */ stream?: boolean; } /** * A class that can decode UTF-8 text in a streaming fashion. * * @example * ```js * const decoder = new TextDecoder(); * let chunk; * let result = ""; * while (chunk = await getNextChunk()) { * result += decoder.decode(chunk, { stream: true }); * } * result += decoder.decode(); * ``` */ export declare class TextDecoder { #private; /** Returns 'utf-8'. */ get encoding(): string; /** * Whether the decoder will throw an exception on an invalid character. * * If false, invalid bytes are replaced by a UTF-8 replacement character. */ get fatal(): boolean; /** Constructs a new TextDecoder. */ constructor(encoding?: string, options?: TextDecoderOptions); /** * Decodes a buffer of UTF-8 encoded data. * * @param buffer The data to decode. If null is passed, represents the last chunk. * @param options Decoding options, whether to decode in a streaming fashion. */ decode(buffer?: ArrayBuffer | ArrayBufferView, options?: DecodeOptions): any; }