156 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			156 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| {{alias}}( N, buffer, stride, offset[, options] )
 | |
|     Creates a readable stream from a strided array-like object.
 | |
| 
 | |
|     In object mode, `null` is a reserved value. If an array contains `null`
 | |
|     values (e.g., as a means to encode missing values), the stream will
 | |
|     prematurely end. Consider an alternative encoding or filter `null` values
 | |
|     prior to invocation.
 | |
| 
 | |
|     In binary mode, if an array contains `undefined` values, the stream will
 | |
|     emit an error. Consider providing a custom serialization function or
 | |
|     filtering `undefined` values prior to invocation.
 | |
| 
 | |
|     If a serialization function fails to return a string or Buffer, the stream
 | |
|     emits an error.
 | |
| 
 | |
|     Parameters
 | |
|     ----------
 | |
|     N: integer
 | |
|         Number of values to stream.
 | |
| 
 | |
|     buffer: ArrayLikeObject
 | |
|         Array-like object from which to create the stream.
 | |
| 
 | |
|     stride: integer
 | |
|         Stride length.
 | |
| 
 | |
|     offset: integer
 | |
|         Starting index.
 | |
| 
 | |
|     options: Object (optional)
 | |
|         Options.
 | |
| 
 | |
|     options.objectMode: boolean (optional)
 | |
|         Specifies whether a stream should operate in "objectMode". Default:
 | |
|         false.
 | |
| 
 | |
|     options.encoding: string|null (optional)
 | |
|         Specifies how Buffer objects should be decoded to strings. Default:
 | |
|         null.
 | |
| 
 | |
|     options.highWaterMark: integer (optional)
 | |
|         Specifies the maximum number of bytes to store in an internal buffer
 | |
|         before pausing the stream.
 | |
| 
 | |
|     options.sep: string (optional)
 | |
|         Separator used to join streamed data. This option is only applicable
 | |
|         when a stream is not in "objectMode". Default: '\n'.
 | |
| 
 | |
|     options.serialize: Function (optional)
 | |
|         Serialization function. The default behavior is to serialize streamed
 | |
|         values as JSON strings. This option is only applicable when a stream is
 | |
|         not in "objectMode".
 | |
| 
 | |
|     Returns
 | |
|     -------
 | |
|     stream: ReadableStream
 | |
|         Readable stream.
 | |
| 
 | |
|     Examples
 | |
|     --------
 | |
|     > function fcn( chunk ) { console.log( chunk.toString() ); };
 | |
|     > var s = {{alias}}( 3, [ 1, 2, 3 ], 1, 0 );
 | |
|     > var o = {{alias:@stdlib/streams/node/inspect-sink}}( fcn );
 | |
|     > s.pipe( o );
 | |
| 
 | |
| 
 | |
| {{alias}}.factory( [options] )
 | |
|     Returns a function for creating readable streams from array-like objects.
 | |
| 
 | |
|     Parameters
 | |
|     ----------
 | |
|     options: Object (optional)
 | |
|         Options.
 | |
| 
 | |
|     options.objectMode: boolean (optional)
 | |
|         Specifies whether a stream should operate in "objectMode". Default:
 | |
|         false.
 | |
| 
 | |
|     options.encoding: string|null (optional)
 | |
|         Specifies how Buffer objects should be decoded to strings. Default:
 | |
|         null.
 | |
| 
 | |
|     options.highWaterMark: integer (optional)
 | |
|         Specifies the maximum number of bytes to store in an internal buffer
 | |
|         before pausing streaming.
 | |
| 
 | |
|     options.sep: string (optional)
 | |
|         Separator used to join streamed data. This option is only applicable
 | |
|         when a stream is not in "objectMode". Default: '\n'.
 | |
| 
 | |
|     options.serialize: Function (optional)
 | |
|         Serialization function. The default behavior is to serialize streamed
 | |
|         values as JSON strings. This option is only applicable when a stream is
 | |
|         not in "objectMode".
 | |
| 
 | |
|     Returns
 | |
|     -------
 | |
|     fcn: Function
 | |
|         Function for creating readable streams.
 | |
| 
 | |
|     Examples
 | |
|     --------
 | |
|     > var opts = { 'objectMode': true, 'highWaterMark': 64 };
 | |
|     > var createStream = {{alias}}.factory( opts );
 | |
| 
 | |
| 
 | |
| {{alias}}.objectMode( N, buffer, stride, offset[, options] )
 | |
|     Returns an "objectMode" readable stream from a strided array-like object.
 | |
| 
 | |
|     In object mode, `null` is a reserved value. If an array contains `null`
 | |
|     values (e.g., as a means to encode missing values), the stream will
 | |
|     prematurely end. Consider an alternative encoding or filter `null` values
 | |
|     prior to invocation.
 | |
| 
 | |
|     Parameters
 | |
|     ----------
 | |
|     N: integer
 | |
|         Number of values to stream.
 | |
| 
 | |
|     buffer: ArrayLikeObject
 | |
|         Array-like object from which to create the stream.
 | |
| 
 | |
|     stride: integer
 | |
|         Stride length.
 | |
| 
 | |
|     offset: integer
 | |
|         Starting index.
 | |
| 
 | |
|     options: Object (optional)
 | |
|         Options.
 | |
| 
 | |
|     options.encoding: string|null (optional)
 | |
|         Specifies how Buffer objects should be decoded to strings. Default:
 | |
|         null.
 | |
| 
 | |
|     options.highWaterMark: integer (optional)
 | |
|         Specifies the maximum number of objects to store in an internal buffer
 | |
|         before pausing streaming.
 | |
| 
 | |
|     Returns
 | |
|     -------
 | |
|     stream: ReadableStream
 | |
|         Readable stream operating in "objectMode".
 | |
| 
 | |
|     Examples
 | |
|     --------
 | |
|     > function fcn( v ) { console.log( v ); };
 | |
|     > var s = {{alias}}.objectMode( 3, [ 1, 2, 3 ], 1, 0 );
 | |
|     > var o = {{alias:@stdlib/streams/node/inspect-sink}}.objectMode( fcn );
 | |
|     > s.pipe( o );
 | |
| 
 | |
|     See Also
 | |
|     --------
 | |
| 
 |