@maximai/maxim-js
Version:
Maxim AI JS SDK. Visit https://getmaxim.ai for more info.
17 lines (16 loc) • 863 B
TypeScript
import type { Attachment } from "../../types";
/**
* Auto-populates missing fields in an attachment based on available information.
*
* This utility function automatically fills in missing properties like name, MIME type,
* and size based on the attachment type and content. For file attachments, it reads
* filesystem metadata. For data attachments, it performs content analysis. For URL
* attachments, it extracts information from the URL structure.
*
* @template T - The specific attachment type being processed
* @param attachment - The attachment object to populate
* @returns A new attachment object with auto-populated fields
* Note: The function suppresses I/O errors when reading file metadata; in such
* cases the size property remains undefined.
*/
export declare function populateAttachmentFields<T extends Attachment>(attachment: T): T;