diff --git a/lib/diff.js b/lib/diff.js index b5688ee..f246c9c 100644 --- a/lib/diff.js +++ b/lib/diff.js @@ -33,7 +33,7 @@ function* diff(pathA, pathB, pathDiff) { debug('finished diffing imgs %s', new Date()); - writePNG(png, pathDiff); + yield thunkify(writePNG)(png, pathDiff); debug('finished img diffing %s', new Date()); @@ -64,10 +64,13 @@ function readPNG(path, callback) { * @param {String} path */ -function writePNG(png, path) { +function writePNG(png, path, callback) { png .pack() - .pipe(fs.createWriteStream(path)); + .pipe(fs.createWriteStream(path)) + .on('close', function() { + callback(null, this); + }); } /** diff --git a/package.json b/package.json index a76527c..e5508ec 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "defaults": "^1.0.2", "mkdirp": "^0.5.1", "nightmare": "^2.0.3", - "pngjs": "^3.0.1", + "pngjs": "^3.3.1", "sprintf-js": "^1.0.3", "thunkify": "^2.1.2", "vo": "^1.0.3"