Skip to content

Instantly share code, notes, and snippets.

@indutny
Forked from heapwolf/pipeaccept.js
Created May 22, 2011 20:19
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 indutny/985848 to your computer and use it in GitHub Desktop.
Save indutny/985848 to your computer and use it in GitHub Desktop.
accepting input from a pipe, nodejs
var data = '';
if (process.stdin.writable) {
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
data += chunk;
});
process.stdin.on('end', function() {
callback(data)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment