Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

end-of-stream

Package Overview
Dependencies
1
Maintainers
1
Versions
15
Issues
File Explorer

Advanced tools

end-of-stream

Call a callback when a readable/writable/duplex stream has completed or failed.

    1.4.4latest

Version published
Maintainers
1
Weekly downloads
26,212,224
decreased by-11.71%

Weekly downloads

Readme

Source

end-of-stream

A node module that calls a callback when a readable/writable/duplex stream has completed or failed.

npm install end-of-stream

Build status

Usage

Simply pass a stream and a callback to the eos. Both legacy streams, streams2 and stream3 are supported.

var eos = require('end-of-stream'); eos(readableStream, function(err) { // this will be set to the stream instance if (err) return console.log('stream had an error or closed early'); console.log('stream has ended', this === readableStream); }); eos(writableStream, function(err) { if (err) return console.log('stream had an error or closed early'); console.log('stream has finished', this === writableStream); }); eos(duplexStream, function(err) { if (err) return console.log('stream had an error or closed early'); console.log('stream has ended and finished', this === duplexStream); }); eos(duplexStream, {readable:false}, function(err) { if (err) return console.log('stream had an error or closed early'); console.log('stream has finished but might still be readable'); }); eos(duplexStream, {writable:false}, function(err) { if (err) return console.log('stream had an error or closed early'); console.log('stream has ended but might still be writable'); }); eos(readableStream, {error:false}, function(err) { // do not treat emit('error', err) as a end-of-stream });

License

MIT

end-of-stream is part of the mississippi stream utility collection which includes more useful stream modules similar to this one.

Keywords

FAQs

What is end-of-stream?

Call a callback when a readable/writable/duplex stream has completed or failed.

Is end-of-stream popular?

The npm package end-of-stream receives a total of 21,116,401 weekly downloads. As such, end-of-stream popularity was classified as popular.

Is end-of-stream well maintained?

We found that end-of-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 25 Sep 2019

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc