Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
stream-events
Advanced tools
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.
$ npm install --save stream-events
var stream = require('stream')
var streamEvents = require('stream-events')
var util = require('util')
function MyStream() {
stream.Duplex.call(this)
streamEvents.call(this)
}
util.inherits(MyStream, stream.Duplex)
MyStream.prototype._read = function(chunk) {
console.log('_read called as usual')
this.push(new Buffer(chunk))
this.push(null)
}
MyStream.prototype._write = function() {
console.log('_write called as usual')
}
var stream = new MyStream
stream.on('reading', function() {
console.log('stream is being asked for data')
})
stream.on('writing', function() {
console.log('stream is being sent data')
})
stream.pipe(stream)
var duplexify = require('duplexify')
var streamEvents = require('stream-events')
var fs = require('fs')
var dup = streamEvents(duplexify())
dup.on('writing', function() {
// do something async
dup.setWritable(/*writable stream*/)
})
fs.createReadStream('file').pipe(dup)
FAQs
Get an event when you're being sent data or asked for it.
The npm package stream-events receives a total of 3,645,528 weekly downloads. As such, stream-events popularity was classified as popular.
We found that stream-events 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.