A micro module to get MIME types from filename, given that filename contains the extension as well.
$ npm install name2mime --save
or
$ yarn add name2mime
Thanks to the amazing guys @ FreeFormatter for compiling this list of 600+ MIME types.
const getMime = require('name2mime');
const value = getMime('filename.jpg');
console.log(value);
// { type: 'image/jpeg', name: 'JPEG Image' }
npm run clean
- Removelib/
directorynpm test
- Run tests with linting and coverage results.npm test:only
- Run tests without linting or coverage.npm test:watch
- You can even re-run tests on file changes!npm test:prod
- Run tests with minified code.npm run test:examples
- Test written examples on pure JS for better understanding module usage.npm run lint
- Run ESlint with airbnb-confignpm run cover
- Get coverage report for your code.npm run build
- Babel will transpile ES6 => ES5 and minify the code.npm run prepublish
- Hook for npm. Do all the checks before publishing your module.
MIT © Hashir Baig