-
-
Save sysnajar/91d8f8bef8243416b2da27db6bbdb0e1 to your computer and use it in GitHub Desktop.
Reading a line from the console in node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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