Gathering detailed insights and metrics for it-to-stream
Gathering detailed insights and metrics for it-to-stream
Gathering detailed insights and metrics for it-to-stream
Gathering detailed insights and metrics for it-to-stream
npm install it-to-stream
Typescript
Module System
Node Version
NPM Version
98.9
Supply Chain
100
Quality
74.6
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
23 Stars
34 Commits
3 Forks
2 Watchers
13 Branches
3 Contributors
Updated on Aug 20, 2024
Latest Version
1.0.0
Package Id
it-to-stream@1.0.0
Size
4.71 kB
NPM Version
7.6.3
Node Version
15.12.0
Published on
Apr 08, 2021
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
Convert streaming iterables to Node.js streams
1npm i it-to-stream
1const toStream = require('it-to-stream')
1// A streaming iterable "source" is just an (async) iterable 2const source = (async function * () { 3 for (const value of [1, 2, 3, 4]) yield Buffer.from(value.toString()) 4})() 5 6const readable = toStream.readable(source) 7 8// Now we have a readable stream, we can consume it by 9readable.on('data', console.log) 10// or 11readable.pipe(writable) 12// or 13pipeline(readable, writable, err => console.log(err || 'done'))
1// A streaming iterable "sink" is an (async) function that takes a "source" 2// and consumes it. 3const sink = async source => { 4 for await (const chunk of source) { 5 console.log(chunk.toString()) 6 } 7} 8 9const writable = toStream.writable(sink) 10 11// Now we have a writable stream, we can pipe to it 12fs.createReadStream('/path/to/file').pipe(writable)
1// A streaming iterable "transform" is a function that takes a "source" and 2// returns a "source". 3const transform = source => (async function * () { 4 for await (const chunk of source) { 5 // Replace all space characters with dashes 6 yield Buffer.from(chunk.toString().replace(/ /g, '-')) 7 } 8})() 9 10const transform = toStream.transform(transform) 11 12// Now we have a transform stream, we can pipe to and from it 13fs.createReadStream('/path/to/file') 14 .pipe(transform) 15 .pipe(fs.createWriteStream('/path/to/file2'))
1const toStream = require('it-to-stream')
toStream.readable(source, [options]): Readable
Convert a source iterable to a Readable
stream.
options
are passed directly to the Readable
constructor.
toStream.writable(sink, [options]): Writable
Convert a sink iterable to a Writable
stream.
options
are passed directly to the Writable
constructor.
toStream.transform(transform, [options]): Transform
Convert a transform iterable to a Transform
stream.
options
are passed directly to the Transform
constructor.
toStream.duplex(duplex, [options]): Duplex
Convert a duplex iterable to a Duplex
stream.
options
are passed directly to the Duplex
constructor.
stream-to-it
Convert Node.js streams to streaming iterablesit-pipe
Utility to "pipe" async iterables togetherFeel free to dive in! Open an issue or submit PRs.
MIT © Alan Shaw
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 17/28 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
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