# resolve-bin

> Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.

Latest version **1.0.1** (published 2022-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install resolve-bin
pnpm add resolve-bin
yarn add resolve-bin
bun add resolve-bin
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-05-20 |
| First published | 2013-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/resolve-bin) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Thorsten Lorenz |
| Maintainers | bendrucker, thlorenz |
| Keywords | resolve, bin, module |

## Links

- npm: https://www.npmjs.com/package/resolve-bin
- Repository: https://github.com/thlorenz/resolve-bin
- Issues: https://github.com/thlorenz/resolve-bin/issues
- npm.io page: https://npm.io/package/resolve-bin

## Dependencies (1)

- [find-parent-dir](https://npm.io/package/find-parent-dir.md) ~0.3.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-05-20
- 1.0.0 — 2021-09-29
- 0.4.3 — 2021-09-29
- 0.4.2 — 2021-09-29
- 0.4.1 — 2021-07-08
- 0.4.0 — 2016-03-27
- 0.3.0 — 2014-05-22
- 0.2.0 — 2014-05-20
- 0.1.1 — 2013-12-12
- 0.1.0 — 2013-11-12

## 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


<!-- START docme generated API please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN docme TO UPDATE -->

<div>
<div class="jsdoc-githubify">
<section>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<dl>
<dt>
<h4 class="name" id="resolveBin"><span class="type-signature"></span>resolveBin<span class="signature">(name, <span class="optional">opts</span>, cb)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Resolves the full path to the bin file of a given package by inspecting the &quot;bin&quot; field in its package.json.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>module name, i.e. 'tap'</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>executable</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>(default: @name) executable name (e.g. 'buster-test')</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>called back with the full path to the bin file of the module or an error if it couldn't be resolved</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/thlorenz/resolve-bin/blob/master/index.js">index.js</a>
<span>, </span>
<a href="https://github.com/thlorenz/resolve-bin/blob/master/index.js#L6">lineno 6</a>
</li>
</ul></dd>
</dl>
</dd>

<dt>
<h4 class="name" id="resolveBin::sync"><span class="type-signature"></span>resolveBin::sync<span class="signature">(name, <span class="optional">opts</span>)</span><span class="type-signature"> &rarr; {string}</span></h4>
</dt>
<dd>
<div class="description">
<p>Synchronous version of resolveBin</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>module name, i.e. 'tap'</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>executable</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>(default: @name) executable name (e.g. 'buster-test')</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy">
<li>
<a href="https://github.com/thlorenz/resolve-bin/blob/master/index.js">index.js</a>
<span>, </span>
<a href="https://github.com/thlorenz/resolve-bin/blob/master/index.js#L55">lineno 55</a>
</li>
</ul></dd>
</dl>
</dd>

</dl>
</article>
</section>
</div>

*generated with [docme](https://github.com/thlorenz/docme)*
</div>
<!-- END docme generated API please keep comment here to allow auto update -->

## License

MIT

---
_Source: https://npm.io/package/resolve-bin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
