Created
January 26, 2022 14:52
-
-
Save PavanKu/e8454a759ea2b4aa5d48d3614f973b99 to your computer and use it in GitHub Desktop.
Read input from console in NodeJS
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
process.stdin.resume(); | |
process.stdin.setEncoding("utf-8"); | |
let stdin_input = ""; | |
process.stdin.on("data", function (input) { | |
stdin_input += input; // Reading input from STDIN | |
}); | |
process.stdin.on("end", function () { | |
main(stdin_input); // Calling function with input | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment