gagle / node-streamifier

Converts a Buffer/String to a readable stream.
MIT License
150 stars 12 forks source link

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

Open kevinchiu opened 8 years ago

kevinchiu commented 8 years ago

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)
ronzeidman commented 7 years ago

await upload.promise()?