How to pipe Node.js scripts together using the Unix | pipe (on the command line)?
I see how to pipe stuff together using Node.js streams, but how do you pipe multiple scripts together using the Unix | , given that some of these scripts can be async? $ ./a.js | ./b.js Example: a.js (chmod 0755) #!/usr/bin/env node setTimeout(function(){ console.log(JSON.stringify({ foo: 'bar' })); }, 10); b.js (chmod 0755) #!/usr/bin/env node console.log(process.argv); This is the output: $ ./a.js | ./b.js [ 'node', '/Users/viatropos/tests/b.js' ] events.js:72 throw er; // Unhandled 'error' event ^ Error: write EPIPE at errnoException (net.js:883:11) at Object.afterWrite (net.js:700:19) At