mhtml-stream
Version:
Zero dependency stream MHTML parser
43 lines (42 loc) • 1.56 kB
TypeScript
/**
* Compare two byte arrays for equality
*/
export declare function bytesEqual(left: Uint8Array, right: Uint8Array): boolean;
/**
* Find index of one byte array in another
*/
export declare function indexOf(haystack: Uint8Array, needle: Uint8Array): number;
/**
* Split a stream of bytes
*
* Takes a stream of data modeled as an async iterator of ArrayBuffer for
* compatibility between node and web, and splits it into an async iterator
* where each value is delimited by the split sequence.
*/
export declare function splitStream(iter: AsyncIterable<Uint8Array>, split: Uint8Array): AsyncIterableIterator<Uint8Array>;
/**
* collect an async iterable of buffers into one
*/
export declare function collect(stream: AsyncIterable<Uint8Array>): Promise<Uint8Array>;
/**
* decoder for quoted printable
*
* If quoted printable "lines" aren't escaped with an "=" then a new line needs
* to be inserted. We use `newLine` which defaults to a single "\n".
*/
export declare function decodeQuotedPrintable(lines: AsyncIterable<Uint8Array>, newLine?: Uint8Array): AsyncIterableIterator<Uint8Array>;
/**
* decoder for base64
*/
export declare function decodeBase64(lines: AsyncIterable<Uint8Array>): AsyncIterableIterator<Uint8Array>;
/**
* decoder for 7bit and 8bit
*/
export declare function decodeIdentity(lines: AsyncIterable<Uint8Array>): AsyncIterableIterator<Uint8Array>;
/**
* decoder for binary
*
* For implementation reasons, binary can't be supported, so we throw a special
* error.
*/
export declare function decodeBinary(): never;