
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
stream-meter
Advanced tools
A stream meter that both counts the bytes piped through it, and can optionally abort on a max size. (e.g. limit a http request size)
Stream Meter is a... uh, meter for streams.
It is a streams2 Transform stream that passes through content, but counts the number of bytes it forwards.
However, give it a size in bytes and it will abort as soon as that threshold is passed. This is useful for capping your hyperquest or http/https clients or servers content size.
npm install stream-meter
Examples:
var meter = require("stream-meter")
// make an un-capped meter
var m = meter()
process.stdin.pipe(m).pipe(process.stdout)
setTimeout(function () {
// Log how much we saw in a couple seconds.
console.log(m.bytes)
}, 2000)
// this will abort (with an Error) in the frame where 1024 bytes is reached
process.stdin.pipe(meter(1024)).pipe(process.stdout)
// create a 1024 byte-capped meter
var m = meter(1024)
m.on("error", function (e) {
// log the error but don't kill the process
console.log(e.message)
})
process.stdin.pipe(m).pipe(process.stdout)
var hyperquest = require("hyperquest")
var req = hyperquest("https://raw.github.com/mranney/node_redis/master/index.js")
var meter = require("stream-meter")(1024)
meter.on("error", function (e) {
console.log(e.message)
console.log("Read %s bytes", meter.bytes)
})
req.pipe(meter).pipe(process.stderr)
$ node hypermeter.js 2> /dev/null
Stream exceeded specified max of 1024 bytes.
Read 7377 bytes
var meter = require("stream-meter")
var stream = meter(size)
stream.on("error", function (e) {
// handle the meter aborting the stream
})
// read the bytes processed by the meter and passed through to any subsequent streams.
var size = stream.bytes
See test/index.js for additional examples.
Size (in bytes) to trigger the stream to abort. It will complete whatever frame it aborted in, so the size streamed will still be >= size but no more than size + highWaterMark
Number of bytes handled and passed through the meter.
MIT
FAQs
A stream meter that both counts the bytes piped through it, and can optionally abort on a max size. (e.g. limit a http request size)
The npm package stream-meter receives a total of 407,195 weekly downloads. As such, stream-meter popularity was classified as popular.
We found that stream-meter 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
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.