Last active
February 2, 2022 15:52
-
-
Save IgorDePaula/96ab21d3812a4ba8c3b1efd7e9e8fb0e to your computer and use it in GitHub Desktop.
This file contains 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
const { promisify } = require('util'); | |
const readline = require("readline"); | |
let rl = readline.createInterface({ input: process.stdin, output: process.stdout }); | |
rl.question[promisify.custom] = (question) => { | |
return new Promise((resolve) => { | |
rl.question(question, resolve); | |
}); | |
}; | |
rl.questionSync = promisify(rl.question); | |
runAsync(); | |
async function runAsync() { | |
let ans = await rl.questionSync("What is your name ?\n"); | |
console.log(ans); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment