sink-transform
A wrapper for concat-stream to make a transform to process the concated result.
Examples
Concat objects
example/reverse.js:
var sink = var JSONStream = var stream = sink stream streamstreamstreamstream
output:
⌘ node example/reverse.js
[
{"z":3}
,
{"y":2}
,
{"x":1}
]
Concat strings
example/concat.js:
var sink = var fs = fs
a.js:
console
output:
⌘ node example/concat.js
console.log('a')
Usage
var sink = var stream =
stream = sink(opts={}, transformFn)
opts
Type: Object
Directly passsed to concat-stream as the first argument.
transformFn
Type: Function
Signature: (concated, done) => {}
Receives the concated result of concat-stream, and a callback to mark the end of the transform operation.
stream = sink.obj(transformFn)
Same with sink({ encoding: 'object' }, transformFn)
stream = sink.str(transformFn)
Same with sink({ encoding: 'string' }, transformFn)