Gathering detailed insights and metrics for stream-events
Gathering detailed insights and metrics for stream-events
Gathering detailed insights and metrics for stream-events
Gathering detailed insights and metrics for stream-events
Get an event when you're being sent data or asked for it.
npm install stream-events
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
7 Stars
18 Commits
4 Forks
2 Watching
1 Branches
4 Contributors
Updated on 10 May 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-10.3%
991,227
Compared to previous day
Last week
1.2%
5,919,755
Compared to previous week
Last month
10.9%
24,920,259
Compared to previous month
Last year
57.8%
231,115,452
Compared to previous year
Get an event when you're being sent data or asked for it.
This is just a simple thing that tells you when _read
and _write
have been called, saving you the trouble of writing this yourself. You receive two events reading
and writing
-- no magic is performed.
This works well with duplexify or lazy streams, so you can wait until you know you're being used as a stream to do something asynchronous, such as fetching an API token.
1$ npm install --save stream-events
1var stream = require('stream') 2var streamEvents = require('stream-events') 3var util = require('util') 4 5function MyStream() { 6 stream.Duplex.call(this) 7 streamEvents.call(this) 8} 9util.inherits(MyStream, stream.Duplex) 10 11MyStream.prototype._read = function(chunk) { 12 console.log('_read called as usual') 13 this.push(new Buffer(chunk)) 14 this.push(null) 15} 16 17MyStream.prototype._write = function() { 18 console.log('_write called as usual') 19} 20 21var stream = new MyStream 22 23stream.on('reading', function() { 24 console.log('stream is being asked for data') 25}) 26 27stream.on('writing', function() { 28 console.log('stream is being sent data') 29}) 30 31stream.pipe(stream)
1var duplexify = require('duplexify') 2var streamEvents = require('stream-events') 3var fs = require('fs') 4 5var dup = streamEvents(duplexify()) 6 7dup.on('writing', function() { 8 // do something async 9 dup.setWritable(/*writable stream*/) 10}) 11 12fs.createReadStream('file').pipe(dup)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 4/13 approved changesets -- score normalized to 3
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
SAST tool is not run on all commits -- score normalized to 0
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