Skip to content

Commit

Permalink
Replace pn with util.promisify
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Feb 23, 2021
1 parent d1adb5a commit e5f1ae0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"mocha": "^7.2.0",
"mocha-lcov-reporter": "^1.3.0",
"node-sass": "^4.14.1",
"pn": "^1.1.0",
"rimraf": "^3.0.2",
"should": "^13.2.3",
"stylus": "^0.54.8",
Expand Down
10 changes: 7 additions & 3 deletions test/svg-sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* @license MIT https://raw.github.com/jkphl/svg-sprite/master/LICENSE.txt
*/

var fs = require('pn/fs'); // https://www.npmjs.com/package/pn
var fs = require('fs');
var util = require('util');
var svg2png = require('svg2png');
var should = require('should'),
path = require('path'),
Expand All @@ -36,6 +37,9 @@ var cwdWeather = path.join(__dirname, 'fixture', 'svg', 'single'),
cwdAlign = path.join(__dirname, 'fixture', 'svg', 'css'),
dest = path.normalize(path.join(__dirname, '..', 'tmp'));

var readFileP = util.promisify(fs.readFile);
var writeFileP = util.promisify(fs.writeFile);

/**
* Add a bunch of SVG files
*
Expand Down Expand Up @@ -130,10 +134,10 @@ function compareSvg2Png(svg, png, expected, diff, done, msg) {
should(err).not.ok;
done();
};
fs.readFile(svg)
readFileP(svg)
.then(svg2png)
.then(function (buffer) {
fs.writeFile(png, buffer)
writeFileP(png, buffer)
.then(function () {
imageDiff({
actualImage: png,
Expand Down

0 comments on commit e5f1ae0

Please sign in to comment.