stream-exhaust

WebJar for stream-exhaust

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

stream-exhaust
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

stream-exhaust
WebJar for stream-exhaust
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/chrisdickinson/stream-exhaust

Download stream-exhaust

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/stream-exhaust/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>stream-exhaust</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/stream-exhaust/
implementation 'org.webjars.npm:stream-exhaust:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/stream-exhaust/
implementation ("org.webjars.npm:stream-exhaust:1.0.2")
'org.webjars.npm:stream-exhaust:jar:1.0.2'
<dependency org="org.webjars.npm" name="stream-exhaust" rev="1.0.2">
  <artifact name="stream-exhaust" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='stream-exhaust', version='1.0.2')
)
libraryDependencies += "org.webjars.npm" % "stream-exhaust" % "1.0.2"
[org.webjars.npm/stream-exhaust "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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

Versions

Version
1.0.2