How to use the define function from mime
Find comprehensive JavaScript mime.define code examples handpicked from public code repositorys.
GitHub: broofa/mime
148 149 150 151 152 153 154 155 156 157
mime.getExtension('text/plain'); // ⇨ 'txt' mime.getExtension('application/json'); // ⇨ 'json' mime.getExtension('text/html; charset=utf8'); // ⇨ 'html' ``` ### mime.define(typeMap[, force = false]) Define [more] type mappings. `typeMap` is a map of type -> extensions, as documented in `new Mime`, above.
320
0
21
GitHub: jsdelivr/bootstrapcdn
8 9 10 11 12 13 14 15 16 17
// constants const ENV = process.env; const NODE_ENV = ENV.NODE_ENV || 'development'; const PUBLIC_DIR = path.join(__dirname, 'public'); const customMime = mime.define({ 'text/javascript': ['js'] }, true); const STATIC_OPTS = {
268
0
62
GitHub: jfhbrook/node-ecstatic
1 2 3 4 5 6 7 8 9 10
const mime = require('mime'); const charset = require('charset'); exports.define = mappings => mime.define(mappings, true); let customGetType = (file, defaultValue) => null; // eslint-disable-line no-unused-vars exports.setCustomGetType = (fn) => { customGetType = fn; };
200
974
32
mime.getType is the most popular function in mime (35 examples)