UNPKG

@limetech/lime-elements

Version:
48 lines 2.19 kB
import { Email } from './email-viewer.types'; /** * Email loading/parsing helpers for `limel-file-viewer`. * * Parses an RFC 5322 / MIME email message (commonly stored as a `.eml` file) * and returns a simplified `Email` view-model. */ /** * Fetches and parses an email message. * * - Prefers `email.html` if present, otherwise falls back to `email.text`. * - Attempts to resolve inline images referenced via `cid:` by replacing * `<img src="cid:...">` with `data:` URLs generated from inline attachments. * * @param url - URL to an email message, usually ending in `.eml`. * @returns A simplified `Email` object for rendering. */ export declare function loadEmail(url: string): Promise<Email>; declare function extractAttachments(email: any): { attachments: Email['attachments']; cidUrlById: Map<string, string>; }; /** * Normalizes a Content-ID by removing surrounding angle brackets. * * Example: `<image@id>` -> `image@id` * * @param contentId - The Content-ID to normalize, optionally surrounded by angle brackets. */ declare function normalizeContentId(contentId?: string): string; declare function replaceCidReferences(html: string, cidUrlById: Map<string, string>): string; declare function decodeCidReference(cid: string): string; declare function getAttachmentBytes(content: unknown): Uint8Array | undefined; declare function resolveDataUrlMimeType(mimeType: unknown, bytes: Uint8Array, filename?: string): string; declare function detectImageMimeTypeFromBytes(bytes: Uint8Array): string | undefined; declare function detectImageMimeTypeFromFilename(filename?: string): string | undefined; export declare const emailLoaderHelpers: { normalizeContentId: typeof normalizeContentId; decodeCidReference: typeof decodeCidReference; replaceCidReferences: typeof replaceCidReferences; getAttachmentBytes: typeof getAttachmentBytes; detectImageMimeTypeFromBytes: typeof detectImageMimeTypeFromBytes; detectImageMimeTypeFromFilename: typeof detectImageMimeTypeFromFilename; resolveDataUrlMimeType: typeof resolveDataUrlMimeType; extractAttachments: typeof extractAttachments; }; export {}; //# sourceMappingURL=email-loader.d.ts.map