Gathering detailed insights and metrics for async-lazystream
Gathering detailed insights and metrics for async-lazystream
Gathering detailed insights and metrics for async-lazystream
Gathering detailed insights and metrics for async-lazystream
npm install async-lazystream
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1 Commits
2 Watching
1 Branches
1 Contributors
Updated on 03 Jun 2021
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-33.3%
2
Compared to previous week
Last month
34.8%
31
Compared to previous month
Last year
96.6%
293
Compared to previous year
1
4
Create streams lazily (event using promises) when they are read from or written to.
async-lazystream: 1.0.0
Sometimes you feel the itch to open all the files at once. You want to pass a bunch of streams around, so the consumer does not need to worry where the data comes from.
From a software design point-of-view this sounds entirely reasonable. Then there is that neat little function fs.createReadStream()
that opens a file and gives you a nice fs.ReadStream
to pass around, so you use what the mighty creator deities of node bestowed upon you.
Error: EMFILE, too many open files
─ node
This package provides two classes based on the node's Streams3 API (courtesy of readable-stream
to ensure a stable version).
A wrapper for readable streams. Extends stream.PassThrough
.
fn
{Function}options
{Object}PassThrough
stream, accessible by fn
.Creates a new readable stream. Once the stream is accessed (for example when you call its read()
method, or attach a data
-event listener) the fn
function is called with the outer lazystream.Readable
instance bound to this
.
If you pass an options
object to the constuctor, you can access it in your fn
function.
1const lazystream = require('async-lazystream'); 2 3new lazystream.Readable(function (options) { 4 return fs.createReadStream('/dev/urandom'); 5});
or async variant:
1const lazystream = require('async-lazystream'); 2 3new lazystream.Readable(async function (options) { 4 // ... some async code 5 return fs.createReadStream('/dev/urandom'); 6});
A wrapper for writable streams. Extends stream.PassThrough
.
fn
{Function}options
{Object}PassThrough
stream, accessible by fn
.Creates a new writable stream. Just like the one above but for writable streams.
1const lazystream = require('async-lazystream'); 2 3new lazystream.Writable(function () { 4 return fs.createWriteStream('/dev/null'); 5});
or async variant:
1const lazystream = require('async-lazystream'); 2 3new lazystream.Writable(async function () { 4 //... some async code 5 return fs.createWriteStream('/dev/null'); 6});
1$ npm install async-lazystream --save
Fork it, branch it, send me a pull request. We'll work out the rest together.
J. Pommerening - code for this module was based on 'lazystream'.
See License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/1 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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