@adonis-agora/media
Version:
Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a
14 lines • 1.15 kB
TypeScript
/**
* Resolve the MIME type an upload path records. Shared by every declared-type gate — `attach` /
* `attachExisting`, the TUS `POST` and direct-upload `initiate` — so a declaration one path
* normalizes is never rejected up front by another. The declared type stands whenever the collection
* accepts it (or declares no whitelist at all). Otherwise — a bare top-level type with no `/`, or a
* concrete type the whitelist rejects — fall back to the file extension: if the extension pins a
* concrete MIME the collection DOES accept, that value is used (and stored on the record). Returns
* `undefined` when nothing resolvable is whitelisted, which the caller reports as a rejection
* listing the allowed types. `fileName` may be a full object key — only its last segment counts.
*/
export declare function resolveDeclaredMimeType(declared: string, fileName: string, accepted: readonly string[] | undefined): string | undefined;
/** The MIME type a file name's extension pins in the built-in map, or `undefined`. */
export declare function mimeTypeFromName(fileName: string): string | undefined;
//# sourceMappingURL=mime_type.d.ts.map