Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.
var resolveBin = require('resolve-bin');
// package.json: "bin": "bin/tap.js"
resolveBin('tap', function (err, bin) {
if (err) return console.error(err);
console.log(bin);
});
// => [..]/resolve-bin/node_modules/tap/bin/tap.jsnpm install resolve-bin
-
Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.
Name Type Argument Description namestring module name, i.e. 'tap'
optsObject <optional>
options
Name Type Description executablestring (default: @name) executable name (e.g. 'buster-test')
cbfunction called back with the full path to the bin file of the module or an error if it couldn't be resolved
-
Synchronous version of resolveBin
Name Type Argument Description namestring module name, i.e. 'tap'
optsObject <optional>
options
Name Type Description executablestring (default: @name) executable name (e.g. 'buster-test')
generated with docme
MIT