Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/resolve-bin
Resolves the full path to the bin file of a given package by inspecting the \"bin\" field in its package.json.
https://github.com/thlorenz/resolve-bin
Last synced: 6 days ago
JSON representation
Resolves the full path to the bin file of a given package by inspecting the \"bin\" field in its package.json.
- Host: GitHub
- URL: https://github.com/thlorenz/resolve-bin
- Owner: thlorenz
- License: mit
- Created: 2013-11-12T17:22:16.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2022-05-20T19:28:18.000Z (over 2 years ago)
- Last Synced: 2024-05-08T17:30:47.424Z (6 months ago)
- Language: JavaScript
- Homepage: https://github.com/thlorenz/resolve-bin
- Size: 26.4 KB
- Stars: 31
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# resolve-bin [![Tests](https://github.com/thlorenz/resolve-bin/actions/workflows/test.yml/badge.svg)](https://github.com/thlorenz/resolve-bin/actions/workflows/test.yml)
Resolves the full path to the bin file of a given package by inspecting the `"bin"` field in its package.json.
```js
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.js
```## Installation
npm install resolve-bin
## API
resolveBin(name, opts, cb)Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.
Parameters:
Name
Type
Argument
Description
name
string
module name, i.e. 'tap'
opts
Object
<optional>
options
Properties
Name
Type
Description
executable
string
(default: @name) executable name (e.g. 'buster-test')
cb
function
called back with the full path to the bin file of the module or an error if it couldn't be resolved
resolveBin::sync(name, opts) → {string}Synchronous version of resolveBin
Parameters:
Name
Type
Argument
Description
name
string
module name, i.e. 'tap'
opts
Object
<optional>
options
Properties
Name
Type
Description
executable
string
(default: @name) executable name (e.g. 'buster-test')
*generated with [docme](https://github.com/thlorenz/docme)*
## License
MIT