Add application/x-arj and text/x-ansi MIME types
This commit is contained in:
parent
f5d2d04b19
commit
0366f0139c
|
@ -179,6 +179,9 @@ function initialize(cb) {
|
|||
function initDatabases(callback) {
|
||||
return database.initializeDatabases(callback);
|
||||
},
|
||||
function initMimeTypes(callback) {
|
||||
return require('./mime_util.js').startup(callback);
|
||||
},
|
||||
function initStatLog(callback) {
|
||||
return require('./stat_log.js').init(callback);
|
||||
},
|
||||
|
|
|
@ -1,10 +1,33 @@
|
|||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
// deps
|
||||
const _ = require('lodash');
|
||||
|
||||
const mimeTypes = require('mime-types');
|
||||
|
||||
exports.startup = startup;
|
||||
exports.resolveMimeType = resolveMimeType;
|
||||
|
||||
function startup(cb) {
|
||||
//
|
||||
// Add in types (not yet) supported by mime-db -- and therefor, mime-types
|
||||
//
|
||||
const ADDITIONAL_EXT_MIMETYPES = {
|
||||
arj : 'application/x-arj',
|
||||
ans : 'text/x-ansi',
|
||||
};
|
||||
|
||||
_.forEach(ADDITIONAL_EXT_MIMETYPES, (mimeType, ext) => {
|
||||
// don't override any entries
|
||||
if(!_.isString(mimeTypes.types[ext])) {
|
||||
mimeTypes[ext] = mimeType;
|
||||
}
|
||||
});
|
||||
|
||||
return cb(null);
|
||||
}
|
||||
|
||||
function resolveMimeType(query) {
|
||||
if(mimeTypes.extensions[query]) {
|
||||
return query; // alreaed a mime-type
|
||||
|
|
Loading…
Reference in New Issue