Installations
npm install duplexer2-unwrappable
Releases
Unable to fetch releases
Developer
deoxxa
Developer Guide
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
No
Node Version
5.11.1
NPM Version
3.8.6
Statistics
72 Stars
49 Commits
22 Forks
5 Watching
2 Branches
9 Contributors
Updated on 03 Nov 2023
Bundle Size
28.43 kB
Minified
8.05 kB
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
3,479
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
2
duplexer2
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
Overview
This is a reimplementation of duplexer using the Streams3 API which is standard in Node as of v4. Everything largely works the same.
Installation
$ npm i duplexer2
API
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
- options - an object specifying the regular
stream.Duplex
options, as well as the properties described below. - writable - a writable stream
- readable - a readable stream
Options
- bubbleErrors - a boolean value that specifies whether to bubble errors
from the underlying readable/writable streams. Default is
true
.
License
3-clause BSD. A copy is included with the source.
Contact
- GitHub (deoxxa)
- Twitter (@deoxxa)
- Email (deoxxa@fknsrs.biz)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Warn: project license file does not contain an FSF or OSI license.
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
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 7 are checked with a SAST tool
Score
3
/10
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