1.2.4 • Published 3 years ago

askpassword v1.2.4

Weekly downloads
582
License
Apache-2.0
Repository
github
Last release
3 years ago

askpassword

A password prompt that does not print data to the TTY.

import askpassword from 'askpassword';

console.log('Please enter a password:');
const password = await askpassword(process.stdin);
console.log('You entered the following password:', password.toString());

The stream passed to askpassword can be any kind of Readable stream. If it is a TTY, askpassword will temporarily remove all other 'data' and 'readable' listeners from it, and set the TTY into raw mode if it has not been in raw mode to begin with.

Why not use read instead?

Because readdoes not work inside a Node.js REPL.

LICENSE

Apache-2.0

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.2.1

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago