1.0.1 • Published 1 year ago

@kldzj/which v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

which

A which (1)-like utility.

Returns the single first instance of the command executable that can be found, and null otherwise.

Usage

// async (promise)
import { which } from '@kldzj/which';

const ffmpegPath = await which('ffmpeg');

// sync (import as you prefer)
import { which, whichSync } from '@kldzj/which';

const nodePath = which.sync('node');
const samePath = whichSync('node');

Options

import { join } from 'path';
import { which } from '@kldzj/which';

const path = await which('executable', {
  // pass additional paths to search in
  paths: [join(__dirname, 'bin')],
  // pass additional extensions to search for
  exeExt: ['.xyz'],
});