Skip to content

Commit

Permalink
Merge pull request #24 from gemini-testing/fix/stream.error
Browse files Browse the repository at this point in the history
fix: do not use streams to avoid 'Stream not writable' error
  • Loading branch information
j0tunn authored Apr 26, 2017
2 parents 4cbde93 + 715ec43 commit fac1692
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.gitignore
.jshintignore
.jshintrc
.npmignore
**/.*
test/
coverage/
10 changes: 5 additions & 5 deletions lib/png.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
};

/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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",
Expand Down

0 comments on commit fac1692

Please sign in to comment.