Closed anishkny closed 6 years ago
Wait for the 'finish' event from the stream.
var stream = pngFileStream('test/**/frame?.png')
.pipe(encoder.createWriteStream({ repeat: -1, delay: 500, quality: 10 }))
.pipe(fs.createWriteStream('myanimated.gif'));
stream.on('finish', function () {
// do stuff
})
You cannot await
the stream directly, but you can wrap the finish
event to a promise which you can await
for (from the top of my head..)
await new Promise((resolve, reject) => {
stream.on('finish', resolve)
stream.on('error', reject)
})
Hi folks,
Thanks for this amazing repo! Wondering how I could wait for the PNG file creation to be done in this example from the README
We would like to post-process the generated PNG but need to wait for it to be done (https://github.com/xiegeo/commit-sudoku/issues/92).