repl.txt (4123B)
1 2 {{alias}}( value[, options] ) 3 Returns a readable stream which always streams the same value. 4 5 In object mode, `null` is a reserved value. If provided `null`, the 6 returned stream will prematurely end. 7 8 Parameters 9 ---------- 10 value: string|Buffer|Uint8Array|any 11 Value to stream. 12 13 options: Object (optional) 14 Options. 15 16 options.objectMode: boolean (optional) 17 Specifies whether a stream should operate in "objectMode". Default: 18 false. 19 20 options.encoding: string|null (optional) 21 Specifies how Buffer objects should be decoded to strings. Default: 22 null. 23 24 options.highWaterMark: integer (optional) 25 Specifies the maximum number of bytes to store in an internal buffer 26 before pausing streaming. 27 28 options.sep: string (optional) 29 Separator used to join streamed data. This option is only applicable 30 when a stream is not in "objectMode". Default: '\n'. 31 32 options.iter: integer (optional) 33 Number of iterations. 34 35 Returns 36 ------- 37 stream: ReadableStream 38 Readable stream. 39 40 Examples 41 -------- 42 > function fcn( chunk ) { console.log( chunk.toString() ); }; 43 > var opts = { 'iter': 10 }; 44 > var s = {{alias}}( 'beep', opts ); 45 > var o = {{alias:@stdlib/streams/node/inspect-sink}}( fcn ); 46 > s.pipe( o ); 47 48 49 {{alias}}.factory( [value, ][options] ) 50 Returns a function for creating readable streams which always stream the 51 same value. 52 53 If provided a value to stream, the returned function returns readable always 54 streams the provided value. 55 56 If not provided a value to stream, the returned function requires that a 57 value be provided at each invocation. 58 59 If provided only one argument and that argument is an object (either empty 60 or not containing any recognized options properties), the function treats 61 the argument as a value to be streamed, not as an options argument. 62 63 Parameters 64 ---------- 65 value: string|Buffer|Uint8Array|any (optional) 66 Value to stream. 67 68 options: Object (optional) 69 Options. 70 71 options.objectMode: boolean (optional) 72 Specifies whether a stream should operate in "objectMode". Default: 73 false. 74 75 options.encoding: string|null (optional) 76 Specifies how Buffer objects should be decoded to strings. Default: 77 null. 78 79 options.highWaterMark: integer (optional) 80 Specifies the maximum number of bytes to store in an internal buffer 81 before pausing streaming. 82 83 options.sep: string (optional) 84 Separator used to join streamed data. This option is only applicable 85 when a stream is not in "objectMode". Default: '\n'. 86 87 options.iter: integer (optional) 88 Number of iterations. 89 90 Returns 91 ------- 92 fcn: Function 93 Function for creating readable streams. 94 95 Examples 96 -------- 97 > var opts = { 'objectMode': true, 'highWaterMark': 64 }; 98 > var createStream = {{alias}}.factory( opts ); 99 100 101 {{alias}}.objectMode( value[, options] ) 102 Returns an "objectMode" readable stream which always streams the same value. 103 104 In object mode, `null` is a reserved value. If provided `null`, the 105 returned stream will prematurely end. 106 107 Parameters 108 ---------- 109 value: any 110 Value to stream. 111 112 options: Object (optional) 113 Options. 114 115 options.encoding: string|null (optional) 116 Specifies how Buffer objects should be decoded to strings. Default: 117 null. 118 119 options.highWaterMark: integer (optional) 120 Specifies the maximum number of objects to store in an internal buffer 121 before pausing streaming. 122 123 options.iter: integer (optional) 124 Number of iterations. 125 126 Returns 127 ------- 128 stream: ReadableStream 129 Readable stream operating in "objectMode". 130 131 Examples 132 -------- 133 > function fcn( v ) { console.log( v ); }; 134 > var opts = { 'iter': 10 }; 135 > var s = {{alias}}.objectMode( 3.14, opts ); 136 > var o = {{alias:@stdlib/streams/node/inspect-sink}}.objectMode( fcn ); 137 > s.pipe( o ); 138 139 See Also 140 -------- 141