Skip to content

Instantly share code, notes, and snippets.

View watson's full-sized avatar

Thomas Watson watson

View GitHub Profile
@watson
watson / finished.js
Last active November 2, 2022 10:06
Is this expected behaviour of stream.finished?
const { PassThrough, finished } = require('stream');
console.log('Waiting for stream to finish...');
finished(new PassThrough(), (err) => {
// This callback is never called and the process exits with exit code 0 right away
console.log('Stream has finished!', { err });
});