Skip to content

About

Ensure that a stream is flowing data without mutating it.

Resources

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

stream-exhaust

NPM version Downloads Build Status Coveralls Status

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

Usage

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.

Strict No LLM / No AI Policy

No LLMs for issues.

No LLMs for patches / pull requests.

No LLMs for comments on the bug tracker, including translation.

English is encouraged, but not required. You are welcome to post in your native language and rely on others to have their own translation tools of choice to interpret your words.

License

MIT

About

Ensure that a stream is flowing data without mutating it.

Resources

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages