UNPKG

mime2ext

Version:

Convert a mime type to a file extension. It works only with popular mime types and it's super lightweight.

12 lines (11 loc) 241 B
/* IMPORT */ import db from 'mime-standard'; /* MAIN */ const mime2ext = (mime) => { mime = mime.trim().toLowerCase(); if (!db.hasOwnProperty(mime)) return ''; return db[mime][0]; }; /* EXPORT */ export default mime2ext;