• Home
Name
Date
Size
#Lines
LOC

..--

.npmignoreD12-May-202413 21

.travis.ymlD12-May-202462 65

LICENSED12-May-20241.1 KiB2217

README.mdD12-May-20241,012 4227

collaborators.mdD12-May-2024352 85

index.jsD12-May-20241,019 5947

package.jsonD12-May-20241.6 KiB6059

test.jsD12-May-20242 KiB123103

README.md

1# stream-each
2
3Iterate all the data in a stream
4
5```
6npm install stream-each
7```
8
9[![build status](http://img.shields.io/travis/mafintosh/stream-each.svg?style=flat)](http://travis-ci.org/mafintosh/stream-each)
10
11## Usage
12
13``` js
14var each = require('stream-each')
15
16each(stream, function (data, next) {
17  console.log('data from stream', data)
18  // when ready to consume next chunk
19  next()
20}, function (err) {
21  console.log('no more data')
22})
23```
24
25## API
26
27#### `each(stream, iterator, cb)`
28
29Iterate the data in the stream by calling the iterator function with `(data, next)`
30where data is a data chunk and next is a callback. Call next when you are ready to
31consume the next chunk. Optionally you can call next with an error to destroy the stream
32
33When the stream ends/errors the callback is called if provided
34
35## License
36
37MIT
38
39## Related
40
41`stream-each` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.
42