
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
combine-stream
Advanced tools
Combine multiple duplex streams into just one.
combine-stream lets you treat a few streams as just one, in a parallel fashion. When you combine a bunch of streams, you write to it as if it was one, and read from it as if it was one, but you are simultaneously writing to all the streams and getting the output from all the streams.
Error events are also aggregated from all the streams and forwarded up through the combining stream for you to listen to in one place.
Code:
var stream = require("stream");
var CombineStream = require("combine-stream");
var streamA = new stream.PassThrough({objectMode: true}),
streamB = new stream.PassThrough({objectMode: true}),
streamC = new stream.PassThrough({objectMode: true});
var combine = new CombineStream([streamA, streamB, streamC]);
combine.on("data", console.log);
combine.write("hello");
combine.end();
Output:
hello
hello
hello
Available via npm:
$ npm install combine-stream
Or via git:
$ git clone git://github.com/deoxxa/combine-stream.git node_modules/combine-stream
NOTE:
Currently this is relying on my fork of readable-stream. Hopefully my patch gets merged and I can remove the hardcoded github dependency.
constructor
Creates a new combine-stream.
new CombineStream(options);
var combine = new CombineStream({
logSize: 100,
recordDuplicates: true,
comparator: functon compare(a, b) {
return a === b;
},
});
Arguments
TransformStream
options, the parameters described below. If this argument is an array, it will
be wrapped in {streams: ...}
.options
Also see example.js.
var stream = require("stream");
var CombineStream = require("combine-stream");
var delayed = function delayed(n) {
var s = new stream.Transform({objectMode: true});
s._transform = function _transform(input, encoding, done) {
var self = this;
return setTimeout(function() {
self.push(input + " " + n);
return done();
}, n);
};
s._flush = function _flush(done) {
console.log("ending!", n);
setTimeout(done, n);
};
return s;
};
var combine = new CombineStream();
var streamA = delayed(100),
streamB = delayed(500);
var combine = new CombineStream([streamA, streamB]);
combine.on("data", console.log);
combine.on("error", console.log);
combine.write("hello 1");
combine.write("hello 2");
combine.write("hello 3");
combine.end(function() {
console.log("everything finished");
});
Output:
hello 1 100
hello 1 500
hello 2 100
hello 2 500
hello 3 100
hello 3 500
ending! 100
ending! 500
everything finished
3-clause BSD. A copy is included with the source.
FAQs
Combine multiple duplex streams into just one
The npm package combine-stream receives a total of 181 weekly downloads. As such, combine-stream popularity was classified as not popular.
We found that combine-stream 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.