Created
April 9, 2021 07:16
-
-
Save miguelmota/2cef5c4ed37d503cf7f578a1a8b78c8d to your computer and use it in GitHub Desktop.
Node.js CLI prompt password with hidden input
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 prompt = require('prompt) | |
async function promptPassword () { | |
prompt.start() | |
prompt.message = '' | |
prompt.delimiter = ':' | |
const { password } = await prompt.get({ | |
properties: { | |
password: { | |
message: 'password', | |
hidden: true | |
} | |
} | |
}) | |
return password | |
} | |
const password = await promptPassword() | |
console.log(password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment