@modern-kit/utils
Version:
1 lines • 1.13 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../src/file/getMIMEType/index.ts"],"sourcesContent":["import { getMIMETypeFromFile } from '../getMIMETypeFromFile';\nimport { getMIMETypeFromResponse } from '../getMIMETypeFromResponse';\nimport { getMIMETypeFromUrl } from '../getMIMETypeFromUrl';\n\nexport async function getMIMEType(data: string | File | Response) {\n try {\n if (data instanceof File) {\n return getMIMETypeFromFile(data);\n }\n\n if (data instanceof Response) {\n return getMIMETypeFromResponse(data);\n }\n\n return await getMIMETypeFromUrl(data);\n } catch (err: any) {\n console.error(`Failed to get the MIME type. message: ${err.message}`);\n return '';\n }\n}\n"],"names":[],"mappings":";;;;;AAIA,eAAsB,YAAY,IAAA,EAAgC;AAChE,EAAA,IAAI;AACF,IAAA,IAAI,gBAAgB,IAAA,EAAM;AACxB,MAAA,OAAO,oBAAoB,IAAI,CAAA;AAAA,IACjC;AAEA,IAAA,IAAI,gBAAgB,QAAA,EAAU;AAC5B,MAAA,OAAO,wBAAwB,IAAI,CAAA;AAAA,IACrC;AAEA,IAAA,OAAO,MAAM,mBAAmB,IAAI,CAAA;AAAA,EACtC,SAAS,GAAA,EAAU;AACjB,IAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,sCAAA,EAAyC,GAAA,CAAI,OAAO,CAAA,CAAE,CAAA;AACpE,IAAA,OAAO,EAAA;AAAA,EACT;AACF;;;;"}