diff --git a/.npmignore b/.npmignore index 16194ff..9b4266e 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,3 @@ -.gitignore -.jshintignore -.jshintrc -.npmignore +**/.* test/ coverage/ diff --git a/lib/png.js b/lib/png.js index 4dd3ce8..0210977 100644 --- a/lib/png.js +++ b/lib/png.js @@ -100,11 +100,11 @@ class PNGImage { * @param {function} callback function */ exports.fromFile = (filePath, callback) => { - const png = new PNG(); - fs.createReadStream(filePath) - .pipe(png) - .on('parsed', () => callback(null, new PNGImage(png))) - .on('error', callback); + fs.readFile(filePath, (error, data) => { + error + ? callback(error, null) + : exports.fromBuffer(data, callback) + }); }; /** diff --git a/package.json b/package.json index 2f60c88..cc598fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "looks-same", - "version": "3.2.0", + "version": "3.2.1", "description": "Pure node.js library for comparing PNG-images, taking into account human color perception.", "main": "index.js", "directories": { @@ -11,7 +11,7 @@ "concat-stream": "^1.5.0", "lodash": "^4.17.3", "parse-color": "^1.0.0", - "pngjs": "^2.2.0" + "pngjs": "^3.0.1" }, "devDependencies": { "chai": "^1.9.1",