Callback when a stream has closed
npm install on-stream-closeCallback when a stream has closed. Alternative to stream.finished and its predecessor end-of-stream that utilize other events (like end and finish) which makes them compatible with older streams but they can't guarantee the stream has fully cleaned up its resources.




``js
const osc = require('on-stream-close')
osc(stream, function (err) {
// Stream has closed
})
`
With promises:
`js
const osc = require('on-stream-close').promises
await osc(stream)
`
- stream: node >= 14.0.0 or >= 10.16.0 if autoDestroy is set to true by implementationreadable-stream
- : >= 3.5.0 if autoDestroy is set to true by implementationstreamx
- : alwaysminipass
- : not out of the box, an implementation can choose to emit close.
With npm do:
```
npm install on-stream-close
MIT © 2020-present Vincent Weevers