# binary-version-check

> Check whether a binary version satisfies a semver range

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

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.1.0 |
| Published | 2024-04-03 |
| First published | 2024-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | cli, binary, executable, version, semver, semantic, range, satisfy, check, validate |

## Links

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

## Dependencies (3)

- [semver](https://npm.io/package/semver.md) ^7.6.0
- [binary-version](https://npm.io/package/binary-version.md) ^7.1.0
- [semver-truncate](https://npm.io/package/semver-truncate.md) ^3.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

- 6.1.0 (latest) — 2024-04-03

## README

# binary-version-check

> Check whether a binary version satisfies a [semver range](https://github.com/npm/node-semver#ranges)

Useful when you have a thing that only works with specific versions of a binary.

## Install

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

## Usage

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

```js
import binaryVersionCheck from 'binary-version-check';

try {
	await binaryVersionCheck('curl', '>=8');
} catch (error) {
	console.log(error);
	//=> 'InvalidBinaryVersion: curl 7.30.0 doesn't satisfy the version requirement of >=8'
}
```

## API

### binaryVersionCheck(binary, semverRange, options?)

#### binary

Type: `string`

The name or path of the binary to check.

#### semverRange

Type: `string`

The [semver range](https://github.com/npm/node-semver#ranges) to check against.

#### options

Type: `object`

##### args

Type: `string[]`\
Default: `['--version']`

The CLI arguments used to get the binary version.

## Related

- [binary-version-check-cli](https://github.com/sindresorhus/binary-version-check-cli) - CLI for this package

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