
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
chunky-stream
Advanced tools
Buffer up chunks and push them based on certain conditions or if a period of time has passed.
chunk-stream
is a simple object-mode transform stream that you can pass any number of testable conditions to force a push/flush of the buffered chunks. It also has a interval feature to allow chunks to flush if a certain time has passed and no further chunks have been received.
fs.createReadStream(file)
.pipe(split2())
.pipe(new ChunkyStream({ interval: 1000 }));
chunky-stream
takes in the following options:
interval
- The amount of time (in ms) to wait since receiving data (0
to disable)ignoreEmpty
- If set to true, do not count an empty string as a chunk (i.e. '', default = false)This is similar to Express middleware, condition
is a function that will run each time a chunk is received to determine whether the buffered chunks should be released.
condition
should have 1 argument:
chunks
- The array of chunks currently buffered and not yet flushed.
condition
should return true
if you want to release the chunks to the consumer of the stream, false
if you want to continue to buffer. var ChunkyStream = require('chunky-stream');
var split = require('split2');
var stream = fs.createReadStream('./test.txt');
var chunk = new ChunkyStream();
chunk.use(function (chunks) {
return (chunks.length === 10);
});
stream.pipe(split()).pipe(chunk).on('data', function (err, lines) {
console.log(lines);
});
FAQs
Streams groups of chunks based on conditions or an interval
We found that chunky-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
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.