var through = require('through')
var tr = through(write, end)
tr.write('beep')
tr.write('boop')
tr.end()

function write(buf) { this.queue(buf.toString().toUpperCase()) }
function end() { }

process.stdin.pipe(tr).pipe(process.stdout)

var through = require('through')
var tr = through(function(buf) {
  this.queue(buf.toString().toUpperCase())
})
process.stdin.pipe(tr).pipe(process.stdout)

Remove examples and in-line the write callback