npm install --save getpassword
const getpass = require('getpassword');
Gets a password from the terminal.
This function prints a prompt (by default 请输入密码:
) and then accepts input without echoing.
options
, an Object, with properties:prompt
, an optional String
callback
, aFunc(error, password)
, with arguments:error
, eithernull
(no error) or anError
instancepassword
, a String
Gets a password from the terminal, return a Promise
. If success, you can get your input-password from the then
function.