Deprecation and updates
- Development and build support are only Node 12+.
- Module itself works on previous Node versions but support will no longer be a thing.
- Uses mime-db data but keep module zero dependency.
- Remove browserify UMD dist files, module browser support will only work on well-known bundlers like esbuild, webpack, rollup, etc.
- Remove bower file, it wasn’t being used for some time already.
- Module is 50% lighter, see more in
API updates and changes
1) mimer function has more case scenarios support
const mimer = require('mimer');
mimer('.pdf'); // -> "application/pdf"
mimer('pdf'); // -> "application/pdf"
mimer('../readme.pdf'); // -> "application/pdf"
2) .get
and .set
are no longer custom functions and is now a Map isolated in mimer/map
instead. Example:
Before
const Mimer = require(‘mimer’);
const mimer = new Mimer();
mimer.set('.monster', 'movie/thriller');
mimer.get('zombie.monster');
After
const mimer = require(‘mimer/map’);
mimer.set('.monster', 'movie/thriller');
mimer.get('zombie.monster');
3) introduce mimer/safe
in order to avoid any change on mimetypes
const mimer = require('mimer/safe');
const mimerMap = require('mimer/map');
mimerMap.set('graphql', 'application/graphql');
// nothing will change
mimer('content.graphql'); // -> "application/octet-stream"