mirror of
https://github.com/khairul169/code-share.git
synced 2025-04-28 16:49:36 +07:00
12 lines
382 B
TypeScript
12 lines
382 B
TypeScript
import { Mime } from "mime/lite";
|
|
import standardTypes from "mime/types/standard.js";
|
|
import otherTypes from "mime/types/other.js";
|
|
|
|
const mime = new Mime(standardTypes, otherTypes);
|
|
mime.define({ "text/javascript": ["jsx", "tsx", "ts"] }, true);
|
|
|
|
export const getMimeType = (
|
|
ext: string,
|
|
defaultMime: string = "application/octet-stream"
|
|
) => mime.getType(ext) || defaultMime;
|