collect-all
Returns a stream which fires a callback and becomes readable once all input is received. Intended for buffer/string streams.
collect([callback], [options]) ⇒ Duplex
⏏
Kind: Exported function
Param | Type | Description |
---|
[callback] | function | called with the collected json data, once available. The value returned by the callback will be passed downstream. |
[options] | object | passed to through stream constructor created to house the above callback function.. If the callback function returns a non-string/buffer value, set objectMode: true . |
Example
An example command-line client script - JSON received at stdin is stamped with received
then written to stdout.
var collectAll = require("collect-all")
process.stdin
.pipe(collectAll(function(input){
input += 'received'
return input
}))
.on("error", function(err){
})
.pipe(process.stdout)
© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.