Skip to content

Commit

Permalink
Wait for open event on the writable stream
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 24, 2020
1 parent df050ac commit 6d92d5c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -26,6 +26,7 @@ const cpFileAsync = async (source, destination, options, progressEmitter) => {

let shouldUpdateStats = false;
try {
await pEvent(writeStream, 'open');
const writePromise = pEvent(writeStream, 'close');
readStream.pipe(writeStream);
await writePromise;
Expand Down

0 comments on commit 6d92d5c

Please sign in to comment.