time-to-botec/js/node_modules/@stdlib/streams/node/from-array/docs/repl.txt
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

150 lines
4.6 KiB
Plaintext

{{alias}}( src[, options] )
Creates a readable stream from an 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
----------
src: ArrayLikeObject
Source value.
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".
options.dir: integer (optional)
Iteration direction. If set to `-1`, a stream iterates over elements
from right-to-left. Default: 1.
Returns
-------
stream: ReadableStream
Readable stream.
Examples
--------
> function fcn( chunk ) { console.log( chunk.toString() ); };
> var s = {{alias}}( [ 1, 2, 3 ] );
> 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".
options.dir: integer (optional)
Iteration direction. If set to `-1`, a stream iterates over elements
from right-to-left. Default: 1.
Returns
-------
fcn: Function
Function for creating readable streams.
Examples
--------
> var opts = { 'objectMode': true, 'highWaterMark': 64 };
> var createStream = {{alias}}.factory( opts );
{{alias}}.objectMode( src[, options] )
Returns an "objectMode" readable stream from an 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
----------
src: ArrayLikeObject
Source value.
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.
options.dir: integer (optional)
Iteration direction. If set to `-1`, a stream iterates over elements
from right-to-left. Default: 1.
Returns
-------
stream: ReadableStream
Readable stream operating in "objectMode".
Examples
--------
> function fcn( v ) { console.log( v ); };
> var s = {{alias}}.objectMode( [ 1, 2, 3 ] );
> var o = {{alias:@stdlib/streams/node/inspect-sink}}.objectMode( fcn );
> s.pipe( o );
See Also
--------