eml-parse-js
Version:
format EML file in browser env
25 lines (24 loc) • 1.01 kB
TypeScript
/**
* Encodes an unicode string into an Uint8Array object as UTF-8
*
* @param {String} str String to be encoded
* @return {Uint8Array} UTF-8 encoded typed array
*/
export declare const encode: (str: string, fromCharset?: string) => Uint8Array;
export declare const arr2str: (arr: Uint8Array) => string;
/**
* Decodes a string from Uint8Array to an unicode string using specified encoding
*
* @param {Uint8Array} buf Binary data to be decoded
* @param {String} Binary data is decoded into string using this charset
* @return {String} Decoded string
*/
export declare function decode(buf: Uint8Array, fromCharset?: string): string;
/**
* Convert a string from specific encoding to UTF-8 Uint8Array
*
* @param {String|Uint8Array} data Data to be encoded
* @param {String} Source encoding for the string (optional for data of type String)
* @return {Uint8Array} UTF-8 encoded typed array
*/
export declare const convert: (data: string | Uint8Array, fromCharset?: string | undefined) => Uint8Array;