From 4957feb48ee0f59c67f2af723a7269622cd1ce5d Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 11 May 2018 20:38:43 +0200 Subject: [PATCH] Fix Node.js 10 compatibility Caused by https://github.com/nodejs/node/pull/18994 Closes #26 --- fs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs.js b/fs.js index 50d6ba1..66e8f20 100644 --- a/fs.js +++ b/fs.js @@ -12,15 +12,15 @@ exports.createWriteStream = fs.createWriteStream.bind(fs); exports.createReadStream = (path, options) => new Promise((resolve, reject) => { const read = fs.createReadStream(path, options); - read.on('error', err => { + read.once('error', err => { reject(new CpFileError(`Cannot read from \`${path}\`: ${err.message}`, err)); }); - read.on('readable', () => { + read.once('readable', () => { resolve(read); }); - read.on('end', () => { + read.once('end', () => { resolve(read); }); });