Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
774 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | ## getpass
|
---|
| 2 |
|
---|
| 3 | Get a password from the terminal. Sounds simple? Sounds like the `readline`
|
---|
| 4 | module should be able to do it? NOPE.
|
---|
| 5 |
|
---|
| 6 | ## Install and use it
|
---|
| 7 |
|
---|
| 8 | ```bash
|
---|
| 9 | npm install --save getpass
|
---|
| 10 | ```
|
---|
| 11 |
|
---|
| 12 | ```javascript
|
---|
| 13 | const mod_getpass = require('getpass');
|
---|
| 14 | ```
|
---|
| 15 |
|
---|
| 16 | ## API
|
---|
| 17 |
|
---|
| 18 | ### `mod_getpass.getPass([options, ]callback)`
|
---|
| 19 |
|
---|
| 20 | Gets a password from the terminal. If available, this uses `/dev/tty` to avoid
|
---|
| 21 | interfering with any data being piped in or out of stdio.
|
---|
| 22 |
|
---|
| 23 | This function prints a prompt (by default `Password:`) and then accepts input
|
---|
| 24 | without echoing.
|
---|
| 25 |
|
---|
| 26 | Parameters:
|
---|
| 27 |
|
---|
| 28 | * `options`, an Object, with properties:
|
---|
| 29 | * `prompt`, an optional String
|
---|
| 30 | * `callback`, a `Func(error, password)`, with arguments:
|
---|
| 31 | * `error`, either `null` (no error) or an `Error` instance
|
---|
| 32 | * `password`, a String
|
---|
Note:
See
TracBrowser
for help on using the repository browser.