Gathering detailed insights and metrics for @stdlib/streams-node-from-circular-array
Gathering detailed insights and metrics for @stdlib/streams-node-from-circular-array
Gathering detailed insights and metrics for @stdlib/streams-node-from-circular-array
Gathering detailed insights and metrics for @stdlib/streams-node-from-circular-array
@taktikorg/unde-animi-omnis
<p align="center"> <a href="https://www.npmjs.com/package/@taktikorg/unde-animi-omnis"><img src="https://img.shields.io/npm/v/@taktikorg/unde-animi-omnis"></a> <a href=""><img src="https://img.shields.io/github/actions/workflow/status/RemiMyrset/@taktikor
@crabas0npm2/exercitationem-suscipit-dicta
security holding package
@crabas0npm2/voluptatum-reiciendis-iure
security holding package
@crabas0npm2/sunt-expedita-placeat
security holding package
Create a readable stream from a circular array-like object.
npm install @stdlib/streams-node-from-circular-array
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
2 Stars
65 Commits
3 Watchers
5 Branches
14 Contributors
Updated on May 26, 2025
Latest Version
0.2.2
Package Id
@stdlib/streams-node-from-circular-array@0.2.2
Unpacked Size
87.84 kB
Size
17.26 kB
File Count
16
NPM Version
8.19.4
Node Version
16.20.2
Published on
Jul 28, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
21
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Create a readable stream from a circular array-like object.
1npm install @stdlib/streams-node-from-circular-array
1var circularArrayStream = require( '@stdlib/streams-node-from-circular-array' );
Returns a readable stream from an array-like object
which repeatedly iterates over a provided value's elements.
1var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); 2 3var iStream; 4var stream; 5var count; 6 7function log( chunk ) { 8 console.log( chunk.toString() ); 9 count += 1; 10 if ( count === 20 ) { 11 stream.destroy(); 12 } 13} 14 15stream = circularArrayStream( [ 1, 2, 3, 4 ] ); 16iStream = inspectStream( log ); 17 18count = 0; 19stream.pipe( iStream );
The function accepts the following options
:
false
.Buffer
objects should be decoded to strings
. Default: null
.'\n'
.1e308
.-1
, the stream iterates over elements from right-to-left. Default: 1
.To set stream options
,
1var opts = { 2 'objectMode': true, 3 'encoding': 'utf8', 4 'highWaterMark': 64 5}; 6 7var stream = circularArrayStream( [ 1, 2, 3, 4 ], opts );
By default, the returned stream is an infinite stream (i.e., never ends). To limit the number of streamed values, set the iter
option.
1var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); 2 3function log( chunk ) { 4 console.log( chunk.toString() ); 5} 6 7var opts = { 8 'iter': 10 9}; 10var stream = circularArrayStream( [ 1, 2, 3, 4 ], opts ); 11var iStream = inspectStream( log ); 12 13stream.pipe( iStream );
By default, when not operating in objectMode, a returned stream delineates individual values using a newline character. To specify an alternative separator, set the sep
option.
1var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); 2 3function log( chunk ) { 4 console.log( chunk.toString() ); 5} 6 7var stream = circularArrayStream( [ 1, 2, 3, 4 ], { 8 'sep': ',', 9 'iter': 10 10}); 11 12var iStream = inspectStream( log ); 13 14stream.pipe( iStream );
By default, when not operating in objectMode, a returned stream serializes values as JSON strings. To specify custom serialization behavior (either to a string
or Buffer
), set the serialize
option.
1var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); 2 3function serialize( v ) { 4 return 'v::' + v.toString(); 5} 6 7function log( chunk ) { 8 console.log( chunk.toString() ); 9} 10 11var stream = circularArrayStream( [ 1, 2, 3, 4 ], { 12 'serialize': serialize, 13 'iter': 10 14}); 15 16var iStream = inspectStream( log ); 17 18stream.pipe( iStream );
Returns a function
for creating readable streams from array-like objects.
1var opts = { 2 'objectMode': true, 3 'encoding': 'utf8', 4 'highWaterMark': 64 5}; 6 7var createStream = circularArrayStream.factory( opts ); 8 9var stream1 = createStream( [ 1, 2, 3, 4 ] ); 10var stream2 = createStream( [ 5, 6, 7, 8 ] ); 11// ...
The method accepts the same options
as circularArrayStream()
.
This method is a convenience function to create streams which always operate in objectMode.
1var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); 2 3function log( v ) { 4 console.log( v ); 5} 6 7var opts = { 8 'iter': 10 9}; 10var stream = circularArrayStream.objectMode( [ 1, 2, 3, 4 ], opts ); 11 12opts = { 13 'objectMode': true 14}; 15var iStream = inspectStream( opts, log ); 16 17stream.pipe( iStream );
This method accepts the same options
as circularArrayStream()
; however, the method will always override the objectMode
option in options
.
objectMode
, 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.array
contains undefined
values, the stream will emit an error. Consider providing a custom serialization function or filtering undefined
values prior to invocation.1var inspectStream = require( '@stdlib/streams-node-inspect-sink' ); 2var randu = require( '@stdlib/random-base-randu' ); 3var Float64Array = require( '@stdlib/array-float64' ); 4var circularArrayStream = require( '@stdlib/streams-node-from-circular-array' ); 5 6function log( v ) { 7 console.log( v.toString() ); 8} 9 10// Create an array containing uniformly distributed pseudorandom numbers: 11var arr = new Float64Array( 10 ); 12 13var i; 14for ( i = 0; i < arr.length; i++ ) { 15 arr[ i ] = randu(); 16} 17 18// Convert the array to a stream: 19var opts = { 20 'objectMode': true, 21 'iter': arr.length * 3 22}; 23var stream = circularArrayStream( arr, opts ); 24 25// Create a writable stream for inspecting stream data: 26opts = { 27 'objectMode': true 28}; 29var iStream = inspectStream( opts, log ); 30 31// Begin data flow: 32stream.pipe( iStream );
@stdlib/streams-node/from-array
: create a readable stream from an array-like object.@stdlib/streams-node/from-iterator
: create a readable stream from an iterator.@stdlib/streams-node/from-strided-array
: create a readable stream from a strided array-like object.This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2024. The Stdlib Authors.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More