
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
event2stream
Advanced tools
A module that transforms an EventEmitter into a ReadableStream. Internally to the module this is accomplished by keeping a buffer in memory. Future releases will include the ability to use other forms of buffering.
The module was created to satify an easy way to test other modules that consume readable streams. Rather than requiring the use of fs.createReadStream or similar, this module allows for any a custom readable stream to be implemented easily.
Example: Convert log events into a stream and connect the stream to stdout.
const events = require( "events" );
const event2stream = require( "event2stream" );
const myEventEmitter = new events.EventEmitter( );
const eventStream = new event2stream( {
eventEmitter: myEventEmitter,
eventNames: [ "log" ]
} );
eventStream.pipe( process.stdout );
myEventEmitter.emit( "log", "This is a log message." );
myEventEmitter.emit( "log", "Another log message" );
setTimeout( function( ){
eventStream.die();
}, 1500 );
Example: Sample event to stream conversion using an object stream. Demonstrates the pause() and resume() functionality.
const events = require( "events" );
const event2stream = require( "event2stream" );
const myEventEmitter = new events.EventEmitter( );
const eventStream = new event2stream( {
eventEmitter: myEventEmitter,
eventNames: [ "hey" ],
mode: "object"
} );
eventStream.pause( );
eventStream.on( "data", function( data ){
console.log( data ); // { "eventName": "hey", "data": { "This": "is", data: 1 }
eventStream.die( );
} );
myEventEmitter.emit( "hey", { "This": "is", data: 1 } );
setTimeout( function( ){
eventStream.resume();
}, 1000 );
FAQs
A module that transforms an EventEmitter into a ReadableStream
We found that event2stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.