@kldzj/which
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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'],
});

Readme

Keywords

Package Sidebar

Install

npm i @kldzj/which

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

11.4 kB

Total Files

8

Last publish

Collaborators

  • kldzj