Gathering detailed insights and metrics for duplexer2-unwrappable
Gathering detailed insights and metrics for duplexer2-unwrappable
Gathering detailed insights and metrics for duplexer2-unwrappable
Gathering detailed insights and metrics for duplexer2-unwrappable
npm install duplexer2-unwrappable
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
72 Stars
49 Commits
22 Forks
5 Watching
2 Branches
9 Contributors
Updated on 03 Nov 2023
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
10
Compared to previous day
Last week
1,500%
16
Compared to previous week
Last month
84.6%
24
Compared to previous month
Last year
76.5%
180
Compared to previous year
1
2
Like duplexer but using Streams3
1var stream = require("stream"); 2 3var duplexer2 = require("duplexer2"); 4 5var writable = new stream.Writable({objectMode: true}), 6 readable = new stream.Readable({objectMode: true}); 7 8writable._write = function _write(input, encoding, done) { 9 if (readable.push(input)) { 10 return done(); 11 } else { 12 readable.once("drain", done); 13 } 14}; 15 16readable._read = function _read(n) { 17 // no-op 18}; 19 20// simulate the readable thing closing after a bit 21writable.once("finish", function() { 22 setTimeout(function() { 23 readable.push(null); 24 }, 500); 25}); 26 27var duplex = duplexer2(writable, readable); 28 29duplex.on("data", function(e) { 30 console.log("got data", JSON.stringify(e)); 31}); 32 33duplex.on("finish", function() { 34 console.log("got finish event"); 35}); 36 37duplex.on("end", function() { 38 console.log("got end event"); 39}); 40 41duplex.write("oh, hi there", function() { 42 console.log("finished writing"); 43}); 44 45duplex.end(function() { 46 console.log("finished ending"); 47});
got data "oh, hi there"
finished writing
got finish event
finished ending
got end event
This is a reimplementation of duplexer using the Streams3 API which is standard in Node as of v4. Everything largely works the same.
$ npm i duplexer2
Creates a new DuplexWrapper
object, which is the actual class that implements
most of the fun stuff. All that fun stuff is hidden. DON'T LOOK.
1duplexer2([options], writable, readable)
1const duplex = duplexer2(new stream.Writable(), new stream.Readable());
Arguments
stream.Duplex
options, as
well as the properties described below.Options
true
.3-clause BSD. A copy is included with the source.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/25 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
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
Score
Last Scanned on 2024-11-25
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