JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 67
  • Score
    100M100P100Q63569F
  • License MIT

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

Package Exports

  • find-bin
  • find-bin/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (find-bin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

find-bin

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 find-bin
yarn add find-bin

Example usage

const { lookpath, lookpathSync } = require('find-bin');

const p = await lookpath('bash');
const pSync = lookpathSync('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`
const p = await lookpath('bash', {
    includeCommonPaths: true,
});
// includeCommonPaths: Will scan for bash in many common binary directories, not just those specified in PATH
const p = await lookpath('bash', {
    findAll: true,
});
// ["/bin/bash"], an array containing all the bash binaries found in any path
// includeCommonPaths: Will scan for bash in many common binary directories, not just those specified in PATH

Motivation