????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/lib/node_modules/express/node_modules/send/node_modules/mime/src/ |
Upload File : |
#!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const mimeScore = require('mime-score');
let db = require('mime-db');
let chalk = require('chalk');
const STANDARD_FACET_SCORE = 900;
const byExtension = {};
// Clear out any conflict extensions in mime-db
for (let type in db) {
let entry = db[type];
entry.type = type;
if (!entry.extensions) continue;
entry.extensions.forEach(ext => {
if (ext in byExtension) {
const e0 = entry;
const e1 = byExtension[ext];
e0.pri = mimeScore(e0.type, e0.source);
e1.pri = mimeScore(e1.type, e1.source);
let drop = e0.pri < e1.pri ? e0 : e1;
let keep = e0.pri >= e1.pri ? e0 : e1;
drop.extensions = drop.extensions.filter(e => e !== ext);
console.log(`${ext}: Keeping ${chalk.green(keep.type)} (${keep.pri}), dropping ${chalk.red(drop.type)} (${drop.pri})`);
}
byExtension[ext] = entry;
});
}
function writeTypesFile(types, path) {
fs.writeFileSync(path, JSON.stringify(types));
}
// Segregate into standard and non-standard types based on facet per
// https://tools.ietf.org/html/rfc6838#section-3.1
const types = {};
Object.keys(db).sort().forEach(k => {
const entry = db[k];
types[entry.type] = entry.extensions;
});
writeTypesFile(types, path.join(__dirname, '..', 'types.json'));