var Writable = require("stream").Writable var inherits = require("util").inherits function Sink(options) { Writable.call(this, options) } inherits(Sink, Writable) Sink.prototype._write = function (chunk, encoding, callback) { console.log(chunk.toString()) callback() } // a simple source stream var Readable = require('stream').Readable; var source = new Readable; source.push('the quick brown fox '); source.push('jumps over the lazy dog.\n'); source.push(null); var sink = new Sink; source.pipe(sink);