UNPKG

mhtml-stream

Version:
28 lines (27 loc) 1.01 kB
import { MhtmlHeaders } from "./headers"; export type { MhtmlHeaders }; /** a file that was encoded in MHTML format */ export interface MhtmlFile { /** the files's headers */ headers: MhtmlHeaders; /** the file's content */ content: Uint8Array; } /** The decoder of any Content-Transfer-Encoding * * @param lines - each line of raw bytes * @returns data - decoded lines */ export type Decoder = (lines: AsyncIterable<Uint8Array>) => AsyncIterable<Uint8Array>; /** options for mhtml parsing */ export interface ParseOptions { /** custom decoders for other Content-Transfer-Encodings */ decoderOverrides?: Map<string, Decoder>; } /** * parse a readable stream into an async iterator of MHTML files * * decoderOverrides can be used to overwrite default encoders or specify your * own if a Content-Transfer-Encoding isn't handled properly */ export declare function parseMhtml(stream: AsyncIterable<Uint8Array>, { decoderOverrides }?: ParseOptions): AsyncIterableIterator<MhtmlFile>;