Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
A module that glues pump and bubble-stream-error to make things easier when your public API returns a stream.
A module that glues pump and bubble-stream-error to make life easier when piping streams internally and returning an outer stream.
Consider the situation when you are piping multiple streams internally and returning an outer stream.
That stream will be handled by users of your module so you need to make sure that the errors coming from the internal streams propagate to the outer one (which bubble-stream-error
takes care of), otherwise they can't be caught and will blow up the process.
Also if one of the inner streams closes you want to make sure that the others get closed as well (which pump
does).
Simply pass the streams you want to pipe together to pump-chain
.
var pump = require('pump-chain');
var crypto = require('crypto');
var fs = require('fs');
var zlib = require('zlib');
function getEncryptedCompressedWordsStream() {
var gzip = zlib.createGzip();
var password = new Buffer('car cat tree fireman');
var aes = crypto.createCipher('aes-256-cbc', password);
var rs = fs.createReadStream('/usr/share/dict/words');
// uncomment to simulate an error
/*
var i = 0;
rs.on('data', function() {
if (++i === 3) {
this.emit('error', new Error('3 is unlucky!'));
}
});
*/
return pump(rs, aes, gzip);
}
getEncryptedCompressedWordsStream().on('error', function handleError(err) {
console.error('\n!!! something bad happened while streaming stuff !!!\n');
throw err;
}).pipe(process.stdout);
npm test
mississippi stream utility collection which includes more useful stream modules similar to this one
FAQs
A module that glues pump and bubble-stream-error to make things easier when your public API returns a stream.
We found that pump-chain 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.