Skip to content

Instantly share code, notes, and snippets.

@chrishulbert
Created July 11, 2011 06:34
Show Gist options
  • Save chrishulbert/1075389 to your computer and use it in GitHub Desktop.
Save chrishulbert/1075389 to your computer and use it in GitHub Desktop.
Reading a line from the console in node.js
console.log ('Input some code:');
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.once('data', function (someCode) {
process.stdin.pause();
console.log ('Code: ' + someCode);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment