mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 10:06:21 +00:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
export const MIME_TYPES: Record<string, string> = {
|
|
".html": "text/html",
|
|
".css": "text/css",
|
|
".js": "text/javascript",
|
|
".mjs": "text/javascript",
|
|
".json": "application/json",
|
|
".svg": "image/svg+xml",
|
|
".png": "image/png",
|
|
".jpg": "image/jpeg",
|
|
".jpeg": "image/jpeg",
|
|
".gif": "image/gif",
|
|
".webp": "image/webp",
|
|
".ico": "image/x-icon",
|
|
".mp4": "video/mp4",
|
|
".mov": "video/quicktime",
|
|
".webm": "video/webm",
|
|
".mp3": "audio/mpeg",
|
|
".wav": "audio/wav",
|
|
".ogg": "audio/ogg",
|
|
".m4a": "audio/mp4",
|
|
".aac": "audio/aac",
|
|
".flac": "audio/flac",
|
|
".opus": "audio/ogg",
|
|
".woff": "font/woff",
|
|
".woff2": "font/woff2",
|
|
".ttf": "font/ttf",
|
|
".otf": "font/otf",
|
|
".txt": "text/plain",
|
|
".md": "text/markdown",
|
|
};
|
|
|
|
export function getMimeType(path: string): string {
|
|
const ext = path.slice(path.lastIndexOf(".")).toLowerCase();
|
|
return MIME_TYPES[ext] || "application/octet-stream";
|
|
}
|
|
|
|
export function isAudioFile(name: string): boolean {
|
|
return (getMimeType(name) ?? "").startsWith("audio/");
|
|
}
|