Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created April 9, 2021 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/2cef5c4ed37d503cf7f578a1a8b78c8d to your computer and use it in GitHub Desktop.
Save miguelmota/2cef5c4ed37d503cf7f578a1a8b78c8d to your computer and use it in GitHub Desktop.
Node.js CLI prompt password with hidden input
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