0
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);
我得到错误的`through2` module.in nodeschool车间从`process.stdin`将数据转换为大写数据上`process.stdout`使用STREAM冒险
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
这正是它说,看起来像thevariable'write'没有定义。 – RRK
在函数定义之后移动该行。 – RRK
函数结束(完成){ done(); } 后处理声明我有一个更多的功能结束。 – gowthami