UNPKG

@vortiq/eml-parse-js

Version:
32 lines (31 loc) 1.3 kB
/** * Gets character set name, e.g. contentType='.....charset='iso-8859-2'....' * @param {String} contentType * @returns {String|undefined} */ export declare const getCharset: (contentType: string) => string | undefined; /** * 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; export declare function normalizeCharset(charset?: string): string;