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