NodeJS Prompt
Sometimes you just need a simple terminal application that requests user input. Here’s a quick way to prompt the user for input:
const readline = require("readline"); const rl = readline.createInterface(process.stdin, process.stdout); rl.on("line", line => { console.log(`You typed ${line}`); rl.prompt(); }); rl.setPrompt("Action> "); rl.prompt();
Comments
Post a Comment