Skip to content

Instantly share code, notes, and snippets.

@totherik
totherik / gist:3305270
Created August 9, 2012 15:41 — forked from pguillory/gist:729616
Hooking into Node.js stdout
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
process.nextTick(function() {
callback(string, encoding, fd)
});