
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
prompt-promise
Advanced tools
Sane CLI user-input (command prompt, confirm, multiline, password) as promises, it can be used with co@4
Sane CLI user-input (command prompt, confirm, multiline, password) as promises, it can be used with co@4
npm i --save prompt-promise
npm run with-co
npm run without-co
For more use-cases see examples
var co = require('co');
var prompt = require('prompt-promise');
var res = [];
prompt('username: ')
.then(function username(val) {
res.push(val);
return prompt.password('password: ');
})
.then(function pasword(val) {
res.push(val);
console.log(res);
prompt.done();
})
.catch(function rejected(err) {
console.log('error:', err.stack);
prompt.finish();
});
// or with `co@4`
co(function * genPrompt() {
var username = yield prompt('username: ');
var password = yield prompt.password('password: ');
return yield [username, password];
})
.then(function fulfilled(array) {
console.log('response:', array);
prompt.end();
})
.catch(function rejected(err) {
console.log('error:', err.stack);
process.stdin.pause();
});
.end()
, .done()
, .finish()
are just aliases for process.stdin.pause();
its required, nah..
Charlike Mike Reagent
Copyright (c) 2014-2015 Charlike Mike Reagent, contributors.
Copyright (c) 2014 TJ Holowaychuk, contributors.
Released under the MIT
license.
Powered and automated by kdf, January 31, 2015
FAQs
Sane CLI user-input (command prompt, confirm, multiline, password) as promises, it can be used with co@4
The npm package prompt-promise receives a total of 3,904 weekly downloads. As such, prompt-promise popularity was classified as popular.
We found that prompt-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.