Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

lookpath

otiai10254kMIT1.2.3TypeScript support: included

The minimum and most straightforward way to check if command exists and where the executable is.

exec.LookPath, command, exists

readme

lookpath

npm version npm download Node.js CI CodeQL 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

Any feedback would be appreciated ;)

License

FOSSA Status