Skip to content

Instantly share code, notes, and snippets.

@lxe
Created September 15, 2014 23:46
Show Gist options
  • Select an option

  • Save lxe/dac114ebbf0995326e3e to your computer and use it in GitHub Desktop.

Select an option

Save lxe/dac114ebbf0995326e3e to your computer and use it in GitHub Desktop.
process.stdin.on('readable', onReadable);
console.log(process.stdin._events);
process.stdout.write('Reading data:');
function onReadable() {
var buf = process.stdin.read();
console.log(buf);
if (!buf) return;
console.log('Read data: ', buf.toString());
process.stdin.removeListener('readable', onReadable);
console.log(process.stdin._events);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment