1.0.1 • Published 2 years ago

module-bin-path v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

module-bin-path

Get the absolute file path to a bin entry of an installed dependency. Useful if you want to include a cli as an npm dependency and spawn it from node.

npm install module-bin-path

Usage

// let's assume npm install --save some-cli was include

const binPath = require('module-bin-path')
console.log('path to the bin entry', binPath('some-cli'))

// to spawn the included cli do

const child = childProcess.spawn(binPath('some-cli'), [ ... ])

API

const path = binPath(moduleName, [binEntry])

Get the absolute path to a modules package.json bin entry.

binEntry is the bin entry name. Defaults to moduleName.

License

MIT