Skip to content

Instantly share code, notes, and snippets.

@sysnajar
Forked from chrishulbert/line.js
Created March 5, 2018 04:07
Show Gist options
  • Save sysnajar/91d8f8bef8243416b2da27db6bbdb0e1 to your computer and use it in GitHub Desktop.
Save sysnajar/91d8f8bef8243416b2da27db6bbdb0e1 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