Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hasbin

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hasbin

Check whether a binary exists in the PATH environment variable

  • 1.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
230K
increased by9.35%
Maintainers
3
Weekly downloads
 
Created

What is hasbin?

The hasbin npm package is used to check if a specific binary is available in the system's PATH. This can be useful for ensuring that required dependencies are installed before running a script or application.

What are hasbin's main functionalities?

Check if a binary exists

This feature allows you to check if a specific binary, such as 'node', exists in the system's PATH. The callback function receives a boolean indicating the presence of the binary.

const hasbin = require('hasbin');

hasbin('node', function(result) {
  if (result) {
    console.log('Node.js is installed');
  } else {
    console.log('Node.js is not installed');
  }
});

Check multiple binaries

This feature allows you to check the existence of multiple binaries in the system's PATH. It iterates over an array of binary names and checks each one, logging the result.

const hasbin = require('hasbin');

const binaries = ['node', 'npm', 'git'];
binaries.forEach(bin => {
  hasbin(bin, function(result) {
    console.log(`${bin} is ${result ? '' : 'not '}installed`);
  });
});

Other packages similar to hasbin

Keywords

FAQs

Package last updated on 27 May 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc