image-size
Advanced tools
Comparing version 0.0.3 to 0.0.5
14
index.js
var fs = require('fs'); | ||
var path = require('path'); | ||
var detector = require('./lib/detector'); | ||
var handlers = { | ||
'png': require('./lib/png'), | ||
'gif': require('./lib/gif') | ||
}; | ||
var libpath = process.env.TEST_COV ? './lib-cov/' : './lib/'; | ||
var detector = require(libpath + 'detector'); | ||
var handlers = {}; | ||
['png', 'gif', 'bmp'].forEach(function (type) { | ||
handlers[type] = require(libpath + type); | ||
}); | ||
module.exports = function (filepath) { | ||
@@ -29,4 +31,4 @@ | ||
} else { | ||
throw new Error('unsupported file type'); | ||
throw new TypeError('unsupported file type'); | ||
} | ||
}; |
@@ -21,3 +21,3 @@ module.exports = function (buffer) { | ||
if ('IHDR' !== buffer.toString('ascii', 12, 16)) { | ||
throw new Error('invalid png'); | ||
throw new TypeError('invalid png'); | ||
} | ||
@@ -24,0 +24,0 @@ return 'png'; |
{ | ||
"name": "image-size", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"description": "get dimensions of any image file", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha --ui bdd --reporter spec specs/*.spec.js" | ||
"test": "make" | ||
}, | ||
@@ -27,4 +27,5 @@ "repository": { | ||
"devDependencies": { | ||
"mocha": "~1.12.0" | ||
"mocha": "~1.12.0", | ||
"expect.js": "~0.2.0" | ||
} | ||
} |
@@ -23,6 +23,6 @@ #### Work in progress | ||
* GIF | ||
* BMP | ||
##### Upcoming | ||
* JPEG | ||
* BMP | ||
* WebP | ||
@@ -29,0 +29,0 @@ * TIFF |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
4281
2
12
66
4