0
votes
var through = require('through2');
var stream = through(write, end);

var tr =function write(buffer,encoding, next) {
    this.push(buffer.toString().toUpperCase()); 
    next();
}
process.stdin.pipe(through(tr)).pipe(process.stdout);

I am getting error

var stream = through(write, end);
                     ^

ReferenceError: write is not defined at Object. (C:\Users\GOTHAMI\stream\transform.js:2:22) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10) at startup (node.js:134:18) at node.js:962:3

1
It is exactly what it says, looks like thevariable write is not defined.rrk
Move that line after the function definition.rrk
function end (done) { done(); } after process statement i have one more function end.gowthami
stream must have two functions write and end that are combined using throughgowthami

1 Answers

0
votes

Just remove this line;

var stream = through(write, end);