What is bin-version-check?
The bin-version-check npm package is designed to check if the version of a binary meets the specified semver range. It is particularly useful for ensuring that the versions of dependencies or tools used in your project meet certain version criteria, helping to avoid compatibility issues or leveraging specific features available only in certain versions.
What are bin-version-check's main functionalities?
Version Checking
This feature allows you to check if the installed version of a binary (e.g., curl) meets a specified semver range. The code sample demonstrates how to check if the version of curl is greater than or equal to 7.30.0.
const binVersionCheck = require('bin-version-check');
binVersionCheck('curl', '>= 7.30.0').then(() => {
console.log('Valid version');
}).catch(error => {
console.error('Incompatible version', error);
});
Other packages similar to bin-version-check
semver
The semver package is a module for semantic versioning comparison. While it does not directly check binary versions, it provides the underlying functionality that packages like bin-version-check might use to compare version strings against specified semver ranges. It's more general-purpose compared to bin-version-check, which is specifically tailored for checking binary versions.
check-node-version
check-node-version is a package that allows you to check if the current node.js and npm versions meet the specified requirements. It is similar to bin-version-check in that it checks versions against specified criteria, but it is specifically focused on node.js and npm rather than arbitrary binaries.
bin-version-check
Check whether a binary version satisfies a semver range
Useful when you have a thing that only works with specific versions of a binary.
Install
$ npm install --save bin-version-check
Usage
$ curl --version
curl 7.30.0 (x86_64-apple-darwin13.0)
const binVersionCheck = require('bin-version-check');
binVersionCheck('curl', '>=8').catch(err => {
throw err;
});
API
binVersionCheck(binary, semverRange, [options])
binary
Type: string
Name or path of the binary to check.
semverRange
Type: string
Semver range to check against.
options
args
Type: array
Default: ['--version']
CLI arguments used to get the binary version.
Related
License
MIT © Sindre Sorhus