node-streamifier icon indicating copy to clipboard operation
node-streamifier copied to clipboard

Correct syntax for using await to wait until streaming is complete?

Open kevinchiu opened this issue 9 years ago • 1 comments

What is the correct syntax for waiting until streaming a buffer is complete?

Currently, I have something like:



  let read = streamifier.createReadStream(imgBuffer)
  let upload = s3Stream.upload({
    Bucket: 'website.com',
    Key: 'website/' + filename
  })
  upload.on('error', function (error) {
    console.error(error)
  })
  await read.pipe(upload)

kevinchiu avatar Jul 14 '16 02:07 kevinchiu

await upload.promise()?

ronzeidman avatar Feb 15 '17 09:02 ronzeidman