# binary-version

> Get the version of a binary in semver format

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

## Install

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

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 7.1.0 |
| Published | 2024-04-03 |
| First published | 2024-04-03 |
| 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/binary-version
- Repository: https://github.com/sindresorhus/binary-version
- Homepage: https://github.com/sindresorhus/binary-version#readme
- Issues: https://github.com/sindresorhus/binary-version/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/binary-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.1.0 (latest) — 2024-04-03

## README

# binary-version

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

## Install

```sh
npm install binary-version
```

## Usage

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

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

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

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

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

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

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

```js
import binaryVersion from 'binary-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

- [binary-version-cli](https://github.com/sindresorhus/binary-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/binary-version · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
