
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
exec-promise
Advanced tools
Testable CLIs with promises
Features
TODO
Download manually or with package-manager.
npm install --save exec-promise
This library requires promises support, for Node versions prior to 0.12 see this page to enable them.
import execPromise from 'exec-promise'
// - The command line arguments are passed as first parameter.
// - Node will exists as soon as the promise is settled (with a code
// different than 0 in case of an error).
// - All errors are catched and properly displayed with a stack
// trace.
// - Any returned value (i.e. not undefined) will be prettily
// displayed
execPromise(async args => {
// ... do what you want here!
})
module.exports = function (args) {
if (args.indexOf('-h') !== -1) {
return 'Usage: my-program [-h | -v]'
}
if (args.indexOf('-v') !== -1) {
var pkg = require('./package')
return 'MyProgram version ' + pkg.version
}
var server = require('http').createServer()
server.listen(80)
// The program will run until the server closes or encounters an
// error.
return require('event-to-promise')(server, 'close')
}
// Executes the exported function if this module has been called
// directly.
if (!module.parent) {
require('exec-promise')(module.exports)
}
Contributions are very welcome, either on the documentation or on the code.
You may:
ISC © Julien Fontanet
FAQs
Testable CLIs with promises
The npm package exec-promise receives a total of 7,331 weekly downloads. As such, exec-promise popularity was classified as popular.
We found that exec-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.