From 66c6ba1596d463a85f96cd022c36ff043e92658d Mon Sep 17 00:00:00 2001 From: Gyubong Lee Date: Thu, 7 Apr 2022 03:04:45 +0900 Subject: [PATCH] Update index.js --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a9d89de..dc9a48a 100644 --- a/index.js +++ b/index.js @@ -21,7 +21,10 @@ const cpFileAsync = async (source, destination, options, progressEmitter) => { readStream.once('error', error => { readError = new CpFileError(`Cannot read from \`${source}\`: ${error.message}`, error); - writeStream.end(); + const nodeMajorVersion = parseInt(process.versions.node.slice(0, 2), 10); + if (nodeMajorVersion < 14) { + writeStream.end(); + } }); let shouldUpdateStats = false;