import { Base64 } from 'js-base64'; import { convert, decode, encode } from './charset'; import { GB2312UTF8, mimeDecode, getBoundary } from './utils'; import { EmailAddress, ParsedEmlJson, ReadedEmlJson, Attachment, BuildOptions, CallbackFn, OptionOrNull, BoundaryRawData, BoundaryConvertedData, BoundaryHeaders } from './interface'; /** * create a boundary */ declare function createBoundary(): string; /** * Builds e-mail address string, e.g. { name: 'PayPal', email: 'noreply@paypal.com' } => 'PayPal' * @param {String|EmailAddress|EmailAddress[]|null} data */ declare function toEmailAddress(data?: string | EmailAddress | EmailAddress[] | null): string; /** * Gets character set name, e.g. contentType='.....charset='iso-8859-2'....' * @param {String} contentType * @returns {String|undefined} */ declare function getCharset(contentType: string): string | undefined; /** * Gets name and e-mail address from a string, e.g. 'PayPal' => { name: 'PayPal', email: 'noreply@paypal.com' } * @param {String} raw * @returns { EmailAddress | EmailAddress[] | null} */ declare function getEmailAddress(rawStr: string): EmailAddress | EmailAddress[] | null; /** * decode section * @param {String} str * @returns {String} */ declare function unquoteString(str: string): string; /** * Decodes 'quoted-printable' * @param {String} value * @param {String} charset * @param {String} qEncoding whether the encoding is RFC-2047’s Q-encoding, meaning special handling of underscores. * @returns {String} */ declare function unquotePrintable(value: string, charset?: string, qEncoding?: boolean): string; /** * Parses EML file content and returns object-oriented representation of the content. * @param {String} eml * @param {OptionOrNull | CallbackFn} options * @param {CallbackFn} callback * @returns {string | Error | ParsedEmlJson} */ declare function parse(eml: string, options?: OptionOrNull | CallbackFn, callback?: CallbackFn): string | Error | ParsedEmlJson; /** * Convert BoundaryRawData to BoundaryConvertedData * @param {BoundaryRawData} boundary * @returns {BoundaryConvertedData} Obj */ declare function completeBoundary(boundary: BoundaryRawData): BoundaryConvertedData | null; /** * buid EML file by ReadedEmlJson or EML file content * @param {ReadedEmlJson} data * @param {BuildOptions | CallbackFn | null} options * @param {CallbackFn} callback */ declare function build(data: ReadedEmlJson | string, options?: BuildOptions | CallbackFn | null, callback?: CallbackFn): string | Error; /** * Parses EML file content and return user-friendly object. * @param {String | ParsedEmlJson} eml EML file content or object from 'parse' * @param { OptionOrNull | CallbackFn} options EML parse options * @param {CallbackFn} callback Callback function(error, data) */ declare function read(eml: string | ParsedEmlJson, options?: OptionOrNull | CallbackFn, callback?: CallbackFn): ReadedEmlJson | Error | string; /** * if you need * eml-format all api */ export { getEmailAddress, toEmailAddress, createBoundary, getBoundary, getCharset, unquoteString, unquotePrintable, mimeDecode, Base64, convert, encode, decode, completeBoundary, ParsedEmlJson, ReadedEmlJson, EmailAddress, Attachment, BoundaryHeaders, parse as parseEml, read as readEml, build as buildEml, GB2312UTF8 as GBKUTF8, };