Gathering detailed insights and metrics for minimal-password-prompt
Gathering detailed insights and metrics for minimal-password-prompt
Gathering detailed insights and metrics for minimal-password-prompt
Gathering detailed insights and metrics for minimal-password-prompt
npm install minimal-password-prompt
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Stars
39 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Sep 15, 2021
Latest Version
1.1.0
Package Id
minimal-password-prompt@1.1.0
Unpacked Size
7.40 kB
Size
2.48 kB
File Count
4
NPM Version
7.5.3
Node Version
15.9.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Minimal hidden password prompt for Node.js! [npm] [github]
package | dependencies | dependents | total lines of production code |
---|---|---|---|
minimal-password-prompt | 0 | 0 | 48 |
password-prompt | 2 | 43 | 2147 |
Seriously, you can also just copy and paste to your project:
1const stdin = process.stdin; 2const stdout = process.stdout; 3 4const captureStdin = (onData) => { 5 stdin.setEncoding('utf-8'); 6 stdin.setRawMode(true); 7 stdin.on('data', onData); 8 stdin.resume(); 9}; 10 11const releaseStdin = (onData) => { 12 stdin.pause(); 13 stdin.removeListener('data', onData); 14 stdin.setRawMode(false); 15 stdout.write('\n'); 16}; 17 18const prompt = (question, ctrlcExits = true) => ( 19 new Promise((resolve, reject) => { 20 let input = ''; 21 const onData = (data) => { 22 switch (data) { 23 case '\u000A': // \n 24 case '\u000D': // \r 25 case '\u0004': // Ctrl+D 26 releaseStdin(onData); 27 resolve(input); 28 break; 29 case '\u0003': // Ctrl+C 30 releaseStdin(onData); 31 ctrlcExits // exit or raise error 32 ? process.exit() 33 : reject(new Error('Ctrl+C')); 34 break; 35 case '\u0008': // Backspace 36 case '\u007F': // Delete 37 input = input.slice(0, -1); 38 break; 39 default: // any other 40 input += data; 41 }; 42 }; 43 captureStdin(onData); 44 stdout.write(question); 45 }) 46); 47 48module.exports = prompt;
(please sill do remember to include MIT license/copyright)
1const prompt = require('minimal-password-prompt'); 2 3prompt('enter password: ').then(pw => { 4 console.log(`Password: ${pw}`); 5});
or with async/await:
1const prompt = require('minimal-password-prompt'); 2 3(async () => { 4 const pw = await prompt('enter password: '); 5 console.log(`password: ${pw}`); 6})();
More examples here
Parameters:
question (String)
prompt output before user inputctrlcExits (Boolean)
, optional
Returns:
Promise<String>
user input during promptInstall with npm:
npm install --save minimal-password-prompt
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More