Created
January 20, 2014 10:32
-
-
Save leepowelldev/8517992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stream = require('stream'); | |
GreenStream.prototype = Object.create(stream.Writable.prototype, { | |
constructor: { value: GreenStream } | |
}); | |
function GreenStream(options) { | |
stream.Writable.call(this, options); | |
} | |
GreenStream.prototype._write = function(chunk, encoding, callback) { | |
process.stdout.write('\u001b[32m' + chunk + '\u001b[39m'); | |
callback(); | |
}; | |
process.stdin.pipe(new GreenStream()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment