Socket
Socket
Sign inDemoInstall

stream-exhaust

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    stream-exhaust

Ensure that a stream is flowing data without mutating it


Version published
Weekly downloads
1.3M
increased by5.16%
Maintainers
1
Install size
7.15 kB
Created
Weekly downloads
 

Readme

Source

stream-exhaust

Ensure that the provided stream is flowing data, even if the stream hasn't been piped to another stream.

var exhaustively = require('stream-exhaust');

exhaustively(fs.createReadStream(__filename))
  .on('close', () => { console.log('all done, despite being streams{1+N}!') });

Prior Art

This is based on stream-consume by aroneous. It is a separate package because it has different semantics:

  1. It does not call .resume() on streams2+ streams. streams2 streams monkeypatch .pipe when entering flowing mode; avoiding resume() avoids that fate.
  2. It does not examine ._readableState; instead it checks for the presence of ._read.

API

exhaust(Stream s) -> Stream s

Takes a stream, s, and returns it. Ensures that the stream is flowing, either by calling .resume() if the stream is a streams1 stream, or by piping it to a "black hole" stream that continually asks for more data.

License

MIT

FAQs

Last updated on 30 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc