1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
{{alias}}( [options] )
Returns a transform stream.
If a transform function is not provided, the returned stream will be a
simple pass through stream.
Parameters
----------
options: Object (optional)
Options.
options.transform: Function (optional)
Callback to invoke upon receiving a new chunk.
options.flush: Function (optional)
Callback to invoke after receiving all chunks and prior to a stream
closing.
options.objectMode: boolean (optional)
Specifies whether a stream should operate in "objectMode". Default:
false.
options.highWaterMark: integer (optional)
Specifies the maximum number of bytes to store in an internal buffer
before ceasing to push downstream.
options.allowHalfOpen: boolean (optional)
Specifies whether a stream should remain open even if one side ends.
Default: false.
options.decodeStrings: boolean (optional)
Specifies whether to decode strings into Buffer objects when writing.
Default: true.
Returns
-------
stream: TransformStream
Transform stream.
Examples
--------
> var s = {{alias}}();
> s.write( 'a' );
> s.write( 'b' );
> s.write( 'c' );
> s.end();
{{alias}}.factory( [options] )
Returns a function for creating transform streams.
Parameters
----------
options: Object (optional)
Options.
options.objectMode: boolean (optional)
Specifies whether a stream should operate in "objectMode". Default:
false.
options.highWaterMark: integer (optional)
Specifies the maximum number of bytes to store in an internal buffer
before ceasing to push downstream.
options.allowHalfOpen: boolean (optional)
Specifies whether a stream should remain open even if one side ends.
Default: false.
options.decodeStrings: boolean (optional)
Specifies whether to decode strings into Buffer objects when writing.
Default: true.
Returns
-------
createStream( transform[, flush] ): Function
Function for creating transform streams.
Examples
--------
> var opts = { 'highWaterMark': 64 };
> var createStream = {{alias}}.factory( opts );
> function fcn( chunk, enc, cb ) { cb( null, chunk.toString()+'-beep' ); };
> var s = createStream( fcn );
> s.write( 'a' );
> s.write( 'b' );
> s.write( 'c' );
> s.end();
{{alias}}.objectMode( [options] )
Returns an "objectMode" transform stream.
Parameters
----------
options: Object (optional)
Options.
options.transform: Function (optional)
Callback to invoke upon receiving a new chunk.
options.flush: Function (optional)
Callback to invoke after receiving all chunks and prior to a stream
closing.
options.highWaterMark: integer (optional)
Specifies the maximum number of bytes to store in an internal buffer
before ceasing to push downstream.
options.allowHalfOpen: boolean (optional)
Specifies whether a stream should remain open even if one side ends.
Default: false.
options.decodeStrings: boolean (optional)
Specifies whether to decode strings into Buffer objects when writing.
Default: true.
Returns
-------
stream: TransformStream
Transform stream operating in "objectMode".
Examples
--------
> var s = {{alias}}.objectMode();
> s.write( { 'value': 'a' } );
> s.write( { 'value': 'b' } );
> s.write( { 'value': 'c' } );
> s.end();
{{alias}}.ctor( [options] )
Returns a custom transform stream constructor.
If provided `transform` and `flush` options, these methods are bound to the
constructor prototype.
If not provided a transform function, the returned constructor creates
simple pass through streams.
The returned constructor accepts the same options as the constructor
factory, *except* for the `transform` and `flush` options, which are not
supported.
Any options provided to the constructor *override* options provided to the
constructor factory.
Parameters
----------
options: Object (optional)
Options.
options.transform: Function (optional)
Callback to invoke upon receiving a new chunk.
options.flush: Function (optional)
Callback to invoke after receiving all chunks and prior to a stream
closing.
options.objectMode: boolean (optional)
Specifies whether a stream should operate in "objectMode". Default:
false.
options.highWaterMark: integer (optional)
Specifies the maximum number of bytes to store in an internal buffer
before ceasing to push downstream.
options.allowHalfOpen: boolean (optional)
Specifies whether a stream should remain open even if one side ends.
Default: false.
options.decodeStrings: boolean (optional)
Specifies whether to decode strings into Buffer objects when writing.
Default: true.
Returns
-------
ctor: Function
Custom transform stream constructor.
Examples
--------
> function fcn( chunk, enc, cb ) { cb( null, chunk.toString()+'-beep' ); };
> var opts = { 'highWaterMark': 64, 'transform': fcn };
> var customStream = {{alias}}.ctor( opts );
> var s = customStream();
> s.write( 'a' );
> s.write( 'b' );
> s.write( 'c' );
> s.end();
See Also
--------
|