Skip to content

Instantly share code, notes, and snippets.

@mafintosh
Created April 18, 2014 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mafintosh/11054481 to your computer and use it in GitHub Desktop.
Save mafintosh/11054481 to your computer and use it in GitHub Desktop.
epipe from stdin
// run this: node test-no-stdin.js | cat -
var buf = new Buffer(512);
var cnt = 0;
buf.fill(97);
setInterval(function() {
console.log(buf.toString()+' #'+(cnt++));
}, 5);
// run this: node test-stdin.js | cat -
process.stdin;
var buf = new Buffer(512);
var cnt = 0;
buf.fill(97);
setInterval(function() {
console.log(buf.toString()+' #'+(cnt++));
}, 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment