1. lookpath
The minimum and most straightforward way to check if command exists and where the executable is.
lookpath
Package: lookpath
Created by: otiai10
Last modified: Sun, 08 May 2022 10:19:22 GMT
Version: 1.2.2
License: MIT
Downloads: 97,970
Repository: https://github.com/otiai10/lookpath

Install

npm install lookpath
yarn add lookpath

lookpath

npm version
npm download
Node.js CI
codecov
Maintainability
FOSSA Status

To check if the command exists and where the executable file is, WITHOUT using child_process.

npm install lookpath

Example usage

 const { lookpath } = require('lookpath');

const p = await lookpath('bash');
// "/bin/bash", otherwise "undefined"

Advanced usage

 const p = await lookpath('bash', {
  include: ['/home/hiromu/.bin'],
  exclude: ['/mnt']
});
// include: Do scan also under `~/.bin`
// exclude: Do NOT scan under `/mnt`

Motivation

Issues

  • https://github.com/otiai10/lookpath/issues

Any feedback would be appreciated ;)

License

FOSSA Status

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin