# bin-version

> Get the version of a binary in semver format

Latest version **7.0.0** (published 2024-04-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2024-04-03 |
| First published | 2014-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 2 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | binary, executable, version, semver, semantic, cli |

## Links

- npm: https://www.npmjs.com/package/bin-version
- Repository: https://github.com/sindresorhus/bin-version
- Homepage: https://github.com/sindresorhus/bin-version#readme
- Issues: https://github.com/sindresorhus/bin-version/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/bin-version

## Dependencies (2)

- [execa](https://npm.io/package/execa.md) ^8.0.1
- [find-versions](https://npm.io/package/find-versions.md) ^6.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 7.0.0 (latest) — 2024-04-03
- 6.0.0 — 2021-04-28
- 5.0.0 — 2021-01-07
- 4.0.0 — 2019-06-15
- 3.1.0 — 2019-04-07
- 3.0.0 — 2018-11-06
- 2.0.0 — 2015-12-12
- 1.0.4 — 2015-08-20
- 1.0.3 — 2015-08-20
- 1.0.2 — 2015-08-20
- 1.0.1 — 2015-06-10
- 1.0.0 — 2014-08-29
- 0.1.0 — 2014-06-14

## README

# bin-version

> Get the version of a binary in [semver](https://github.com/npm/node-semver) format

## Install

```sh
npm install bin-version
```

## Usage

```console
$ curl --version
curl 7.30.0 (x86_64-apple-darwin13.0)
```

```js
import binaryVersion from 'bin-version';

console.log(await binaryVersion('curl'));
//=> '7.30.0'
```

```console
$ openssl version
OpenSSL 1.0.2d 9 Jul 2015
```

```js
import binaryVersion from 'bin-version';

console.log(await binaryVersion('openssl'));
//=> '1.0.2'
```

```console
$ openssl version
OpenSSL 1.0.2d 9 Jul 2015
```

```js
import binaryVersion from 'bin-version';

console.log(await binaryVersion('openssl', {args: ['version']}));
//=> '1.0.2'
```

## API

### binaryVersion(binary, options?)

Returns a `Promise<string>` with the version of the `binary`.

#### binary

Type: `string`

The name of or path to the binary to get the version from.

#### options

Type: `object`

##### args

Type: `string[]`

The arguments to pass to `binary` so that it will print its version.

If not specified, predefined arguments will be used for known binaries, or `['--version']` and `['version']` arguments will be tried.

## Related

- [bin-version-cli](https://github.com/sindresorhus/bin-version-cli) - CLI for this module
- [find-versions](https://github.com/sindresorhus/find-versions) - Find semver versions in a string

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