Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

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
28,397,026
increased by0.6%

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 26,848,951 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. It has 1 open source maintainer collaborating on the project.

Last updated on 25 Sep 2019
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