const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
readline.question('Who are you?', name => {
console.log(`Hey there ${name}!`);
readline.close();
});
process.stdin.on('data', (data) => {
console.log(`You typed ${data}`);
})
// npm i readline-sync
import readlineSync from 'readline-sync';
const text = readlineSync.question('enter text:');
const password = readlineSync.question('password:', {
hideEchoBack: true // The typed text on screen is hidden by `*` (default).
});