最近,我开始学习与Nodeschool练习Node.js。但我有问题,对这个问题的理解解决方案:了解异步Javascript代码
Your program will get some html written to stdin. Convert all the inner html to
upper-case for elements with a class name of "loud".
官方的解决办法是:
var trumpet = require('trumpet');
var through = require('through');
var tr = trumpet();
var loud = tr.select('.loud').createStream();
loud.pipe(through(function(buf){
this.queue(buf.toString().toUpperCase());
})).pipe(loud);
process.stdin.pipe(tr).pipe(process.stdout);
我不能理解的是,这一部分:
process.stdin.pipe(tr).pipe(process.stdout);
这个代码不使用响亮变量输出解决方案。任何人都可以解释我这个魔法代码?
P.S:我来自PHP的Node.js,并且在理解Async Javascript时遇到了问题。
你应该阅读'trumpet'的文档可以[在这里找到](https://github.com/substack/node-trumpet),因为这似乎是你不理解的模块。 –