You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
wappalyzer/bin/wappalyzer-validate-icons

30 lines
843 B

#!/usr/bin/env node
var
app,
modulesPath = process.env.WAPPALYZER_NODE_PATH !== undefined ? process.env.WAPPALYZER_NODE_PATH + '/node_modules/' : '',
fs = require('fs'),
fileType = require(modulesPath + 'file-type'),
readChunk = require(modulesPath + 'read-chunk')
json = require(process.env.WAPPALYZER_ROOT + '/src/apps.json');
for ( app in json.apps ) {
10 years ago
(function(app) {
var path = process.env.WAPPALYZER_ROOT + '/src/icons/' + app + '.png';
10 years ago
fs.exists(path, function(exists) {
var buffer;
10 years ago
if ( exists ) {
buffer = fileType(readChunk.sync(path, 0, 262));
10 years ago
if ( buffer.mime !== 'image/png' ) {
throw new Error('Incorrect mimetype "' + buffer.mime + '": src/icons/' + app + '.png');
}
} else {
throw new Error('Missing file: src/icons/' + app + '.png');
}
10 years ago
});
}(app));
};