Through
through2@0.4.x
A basic wrapper function around This is the base function used by super-stream
as a standalone module. Also it is a drop in replacement for through2
Why shouldn't you use through2
instead of this module?
You wouldn't if all you need is a basic helper for creating stream.Transform
.
But if you need some functional style transforms and other stream utilities and reduce your dependencies at the same time, this is your basic through stream you are looking for. For all the API, go here
See also.
super-stream
super-stream.each
super-stream.map
super-stream.reduce
super-stream.filter
super-stream.junction
super-stream.pipeline
through([options,] [transformFn,] [flushFn]);
this is how
var expect = expect;var through = var streamA = through;var streamB = ; thr = through; streamA; streamA;
var streamA = ; thrObj = through;var streamB = thrObj; streamA;streamA;
through.ctor([options,] [transformFn,] [flushFn]);
Note: This is the same ctor
method from through2
If called without arguments, returns a passthrough Transform
var Transform = Transform;var Ctor = through;var streamA = ; // no need for the new operatorvar streamB = ; //overriding optionsvar streamC = ; tobean;tobean;tobean;
through.obj([transfromFn,] [flushFn])
It is a conveniece method for through({objectMode: true}, transformFn, flushFn);
If called without arguments, returns a passthrough Transform
Note: This is the same obj
method from through2
var stream = through;stream;
through.buf([transfromFn,] [flushFn])
It is a conveniece method for through({objectMode: false}, transformFn, flushFn);
If called without arguments, returns a passthrough Transform
// see the factory method.var thr = through;var myData = 'my data'; var streamBuf = thr;streamBuf;
through.factory([options]);
A factory method for creating a custom through
instance.
var thrObj = through; var streamObj = ;streamObj;
var myData = 'my data';var thrBuf = through; var streamBuf = ;streamBuf;
License
The MIT License (MIT)
Copyright (c) 2014 Markuz GJ
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.