我刚接触node.js,正在尝试按顺序执行两个进程,第一个进程的标准输出通过管道传递到第二个进程的标准输入。然后第二个进程的标准输出应该通过变量res作为URL请求的响应被传递。代码在这里。其中一部分是由他人编写的,所以我可能有误解:
var sox = spawn("sox", soxArgs)
var rubberband = spawn("rubberband", rubberbandArgs)
sox.stdout.pipe(rubberband.stdin)
rubberband.stdout.pipe(res) #won't send to res anything, why?
#rubberband.stdin.pipe(res) won't send to res anything, either!
#sox.stdout.pipe(res) will work just fine
sox.stdin.write(data)
sox.stdin.end()
#the actual sox process will not execute until sox.stdin is filled with data..?
非常感谢您的帮助!我已经花费数小时研究了这个问题!