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)
var binVersionCheck = require('bin-version-check');
binVersionCheck('curl', '>=8', function (err) {
if (err) {
throw err;
}
});
CLI
$ npm install --global bin-version-check
$ bin-version-check --help
Usage
bin-version-check <binary> <semver-range>
Example
$ curl --version
curl 7.30.0 (x86_64-apple-darwin13.0)
$ bin-version-check curl '>=8'
curl 7.30.0 does not satisfy the version requirement of >=8
Exits with code 0 if the semver range is satisfied and 1 if not
License
MIT © Sindre Sorhus