
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
hook-writable-stream
Advanced tools
Hooking into Node.js writable stream
Based on this gist. Useful when you need to test Node writable streams such as stdout.
$ npm install --save-dev hook-writable-stream
var hookWritableStream = require('hook-writable-stream');
var hook = hookWritableStream(process.stdout, false, function(string) {
//=> string === 'hooked!\n'
});
console.log('hooked!');
hook.unhook();
console.log('unhooked!');
//=> 'unhooked!' is shown on your console
var hookWritableStream = require('hook-writable-stream');
var through = require('through2');
var hook = hookWritableStream(process.stdout, false);
var stream = hook.stream;
stream.pipe(through(function(chunk, enc, cb) {
//=> chunk.toString() === 'hooked!\n'
cb(chunk);
}));
console.log('hooked!');
hook.unhook();
console.log('unhooked!');
//=> 'unhooked!' is shown on your console
Returns an object.
Type: function
Call to unhook the writable stream.
A stream that you can consume. The data that was going to written to the original stream is written to this stream.
A node writable stream such as process.stdout.
true to keep writing to the original stream.
Whatever is written to the original stream.
MIT © Steve Mao
FAQs
Hooking into Node.js writable stream
We found that hook-writable-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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.