4.0.0 • Published 8 months ago

which v4.0.0

Weekly downloads
35,677,285
License
ISC
Repository
github
Last release
8 months ago

which

Like the unix which utility.

Finds the first instance of a specified executable in the PATH environment variable. Does not cache the results, so hash -r is not needed when the PATH changes.

USAGE

const which = require('which')

// async usage
// rejects if not found
const resolved = await which('node')

// if nothrow option is used, returns null if not found
const resolvedOrNull = await which('node', { nothrow: true })

// sync usage
// throws if not found
const resolved = which.sync('node')

// if nothrow option is used, returns null if not found
const resolvedOrNull = which.sync('node', { nothrow: true })

// Pass options to override the PATH and PATHEXT environment vars.
await which('node', { path: someOtherPath, pathExt: somePathExt })

CLI USAGE

Just like the BSD which(1) binary but using node-which.

usage: node-which [-as] program ...

You can learn more about why the binary is node-which and not which here

OPTIONS

You may pass an options object as the second argument.

  • path: Use instead of the PATH environment variable.
  • pathExt: Use instead of the PATHEXT environment variable.
  • all: Return all matches, instead of just the first one. Note that this means the function returns an array of strings instead of a single string.
cross-spawnglobal-prefixnode-notifiernode-gypnpmspawn-wrapkarma-chrome-launchernpm-lifecycle@xata.io/clifork-appcenter-clifree-minconfigcopycreate-backyardcuc-gaf@pearjs/dev@huyhpham/rn-line@homeboxio/dreddarchetype-librarybalena-cli@fu1996/osc-clicordova-fetchcordova-ioscordova-androidcordova-servecomponennenttdu-scripts@instructure/ui-icons-build@architect-io/clieasy-select-rn@g7fe/g7-scriptsvuedragdropuploadimagesreact-native-bluetooth2killi8n-react-native-fast-imageaplus-web-init-v@httptoolkit/win-detect-browsers@aeppic/install-image-serverpipihome@s-isabella/docker-startcreate-geosecma-libraryrn-send-sms@rock-kit/command-utils@rock-kit/ui-icons-buildspecify-importsbabel-specify-imports@icanpm/api-masterbappo-scriptszrd-cliharden-clireact-tools-cli@arisageha/react-lazyload@arisageha/react-lazyload-fix@oneplanetcrowd/developersfoshata-markdownnow-denolisnow-denolis-dev@cashremit/cr-streamline-icons@otogira/now-denolisllr-clilffg-scripts@lgslabs/bits-fsxubei-cli@particle/device-os-flash@almeidaa/ms@otogira/now-denolis-dev@adobe/aio-cli-plugin-cnareact-native-template-rfbaselein-nodegsmlg-scriptsairscanairscan-example@chrissong/clibb-chatzkf-admin-cruduplusclireact-native-esc-pos-sahaabreact-test01-clishelltools@borisovart/atol-kkt-module@yinzhou/electron-build-tools@frxf/frxfs40-scriptsjdkfindertotal-traffic-traderdeneme323112collider-cli@orcproject/orc@steven-torres/jsxr@texttree/demo-bsa-reference-rcl@robmayer/create-react-libraryeslint-config-japhykarma-brave-windows-launcher@rakkasjs/create@fundefund/funde_ck@ntt_app/react-native-custom-notificationnode-inspector-ryanonejspm-nugetreact-native-custom-text-hwjames@sonammalhotra/lotideremotedebug-ios-webkit-adapter-mod@temporg/command-utils
4.0.0

8 months ago

3.0.1

12 months ago

3.0.0

1 year ago

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.3.1

6 years ago

1.3.0

7 years ago

1.2.14

7 years ago

1.2.13

7 years ago

1.2.12

7 years ago

1.2.11

8 years ago

1.2.10

8 years ago

1.2.9

8 years ago

1.2.8

8 years ago

1.2.7

8 years ago

1.2.6

8 years ago

1.2.5

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

12 years ago

1.0.4

12 years ago

1.0.3

12 years ago

1.0.2

13 years ago

1.0.1

13 years ago

1.0.0

13 years ago