spion / promise-streams

A collection of node.js streams that work well with promises (through, map, reduce, etc...)
93 stars 11 forks source link

pipe and wait on sink #15

Open reconbot opened 7 years ago

reconbot commented 7 years ago

I wanted to make sure I was using the right pattern. I'm doing a read and a write stream to processes some data after creating the streams I'm writing;

await ps.pipe(source, sink)
await ps.wait(sink)
console.log('Success!')

I know the pipe waits for the source to finish, but I want to ensure the sink is done writing too. Is there a better way?

Thanks!