imgref.js var fs = require('fs');var dir = process.argv[2];var list = fs.readdirSync(dir);var typeMap = { '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.png': 'image/png', '.bmp': 'image/bmp', '.tiff': 'image/tiff'}func
var fs = require('fs'); var dir = process.argv[2]; var list = fs.readdirSync(dir); var typeMap = { '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.png': 'image/png', '.bmp': 'image/bmp', '.tiff': 'image/tiff' } function getPicType(file) { for(var k in typeMap) { if(file.endsWith(k)) return [k, typeMap[k]]; } return null; } for(var file of list) { var tp = getPicType(file); if(!tp) continue; console.log(' '); }