stream-collector

WebJar for stream-collector

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

stream-collector
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

stream-collector
WebJar for stream-collector
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mafintosh/stream-collector

Download stream-collector

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : once jar [1.3.1,2)

Project Modules

There are no modules declared in this project.

stream-collector

Buffer data from a stream into an array if a callback is provided

npm install stream-collector

build status

Usage

var collect = require('stream-collector')

collect(stream, function(err, list) {
  // list contains all data chunks from stream  
})

The stream is always returned from the function. If a callback isn't provided no buffering will occur. This allows you to do the following pattern where if you provide a callback the stream will be buffered (similar to how request works)

var read = function(cb) {
  var stream = db.createReadStream()
  return collect(stream, cb)
}

var stream = read() // does not buffer

read(function(err, list) {
  // buffers the data
})

License

MIT

Versions

Version
1.0.1