repl.txt (3553B)
1 2 {{alias}}( [options,] clbk ) 3 Returns a writable stream for inspecting stream data. 4 5 Parameters 6 ---------- 7 options: Object (optional) 8 Options. 9 10 options.objectMode: boolean (optional) 11 Specifies whether a stream should operate in "objectMode". Default: 12 false. 13 14 options.highWaterMark: integer (optional) 15 Specifies the maximum number of bytes to store in an internal buffer 16 before ceasing to push downstream. 17 18 options.decodeStrings: boolean (optional) 19 Specifies whether to encode strings as `Buffer` objects before writing 20 data to a returned stream. Default: true. 21 22 options.defaultEncoding: string (optional) 23 Default encoding when not explicitly specified when writing data. 24 Default: 'utf8'. 25 26 clbk: Function 27 Callback to invoke upon receiving data. 28 29 Returns 30 ------- 31 stream: WritableStream 32 Writable stream. 33 34 Examples 35 -------- 36 > function clbk( chunk, idx ) { console.log( chunk.toString() ); }; 37 > var s = {{alias}}( clbk ); 38 > s.write( 'a' ); 39 > s.write( 'b' ); 40 > s.write( 'c' ); 41 > s.end(); 42 43 44 {{alias}}.factory( [options] ) 45 Returns a function for creating writable streams for inspecting stream data. 46 47 Parameters 48 ---------- 49 options: Object (optional) 50 Options. 51 52 options.objectMode: boolean (optional) 53 Specifies whether a stream should operate in "objectMode". Default: 54 false. 55 56 options.highWaterMark: integer (optional) 57 Specifies the maximum number of bytes to store in an internal buffer 58 before ceasing to push downstream. 59 60 options.decodeStrings: boolean (optional) 61 Specifies whether to encode strings as `Buffer` objects before writing 62 data to a returned stream. Default: true. 63 64 options.defaultEncoding: string (optional) 65 Default encoding when not explicitly specified when writing data. 66 Default: 'utf8'. 67 68 Returns 69 ------- 70 createStream( clbk ): Function 71 Function for creating writable streams. 72 73 Examples 74 -------- 75 > var opts = { 'objectMode': true, 'highWaterMark': 64 }; 76 > var createStream = {{alias}}.factory( opts ); 77 > function clbk( chunk, idx ) { console.log( chunk.toString() ); }; 78 > var s = createStream( clbk ); 79 > s.write( 'a' ); 80 > s.write( 'b' ); 81 > s.write( 'c' ); 82 > s.end(); 83 84 85 {{alias}}.objectMode( [options,] clbk ) 86 Returns an "objectMode" writable stream for inspecting stream data. 87 88 Parameters 89 ---------- 90 options: Object (optional) 91 Options. 92 93 options.highWaterMark: integer (optional) 94 Specifies the maximum number of objects to store in an internal buffer 95 before ceasing to push downstream. 96 97 options.decodeStrings: boolean (optional) 98 Specifies whether to encode strings as `Buffer` objects before writing 99 data to a returned stream. Default: true. 100 101 options.defaultEncoding: string (optional) 102 Default encoding when not explicitly specified when writing data. 103 Default: 'utf8'. 104 105 clbk: Function 106 Callback to invoke upon receiving data. 107 108 Returns 109 ------- 110 stream: WritableStream 111 Writable stream operating in "objectMode". 112 113 Examples 114 -------- 115 > function clbk( chunk, idx ) { console.log( chunk.toString() ); }; 116 > var s = {{alias}}.objectMode( clbk ); 117 > s.write( { 'value': 'a' } ); 118 > s.write( { 'value': 'b' } ); 119 > s.write( { 'value': 'c' } ); 120 > s.end(); 121 122 See Also 123 -------- 124