Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
bin-version
Advanced tools
The bin-version npm package is designed to retrieve the version of a binary executable in your system. It is useful for developers who need to programmatically check and manage the versions of dependencies and tools that their applications interact with.
Get binary version
This feature allows you to fetch the version of a specified binary executable. The code sample demonstrates how to retrieve the version of 'curl' using the bin-version package.
const binVersion = require('bin-version');
(async () => {
try {
const version = await binVersion('curl');
console.log(version);
} catch (error) {
console.error('Error:', error);
}
})();
This package checks if a given command exists in the system path. Unlike bin-version, which retrieves the version of the binary, command-exists simply checks for the existence of the binary without providing version information.
find-versions is a package that extracts semver versions from a string. It can be used in conjunction with other tools to parse version numbers from command output, offering a more flexible approach compared to bin-version which directly fetches the version from the binary.
Get the version of a binary in semver format
npm install bin-version
$ curl --version
curl 7.30.0 (x86_64-apple-darwin13.0)
import binaryVersion from 'bin-version';
console.log(await binaryVersion('curl'));
//=> '7.30.0'
$ openssl version
OpenSSL 1.0.2d 9 Jul 2015
import binaryVersion from 'bin-version';
console.log(await binaryVersion('openssl'));
//=> '1.0.2'
$ openssl version
OpenSSL 1.0.2d 9 Jul 2015
import binaryVersion from 'bin-version';
console.log(await binaryVersion('openssl', {args: ['version']}));
//=> '1.0.2'
Returns a Promise<string>
with the version of the binary
.
Type: string
The name of or path to the binary to get the version from.
Type: object
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.
FAQs
Get the version of a binary in semver format
The npm package bin-version receives a total of 1,789,168 weekly downloads. As such, bin-version popularity was classified as popular.
We found that bin-version demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.