A library for locating files in the directories specified by the PATH (or Path) environment variable.
Supports Windows' PATHEXT environment variable.
A smaller (50kb -> 7kb), faster alternative to which.
pnpm
pnpm add tinywhichyarn
yarn add tinywhichnpm
npm install tinywhichbun
bun add tinywhichimport { which } from "tinywhich"
// const { which } = require("tinywhich")
which("node") // "[absolute path]/node"
which("notfound") // null| pkg | install size | bundle size | bench (linux) | bench (windows) |
|---|---|---|---|---|
| tinywhich | 7kb | 552b | 19µs | 216µs |
| which | 50kb (x7) | 3.88kb (x7) | 60µs (x3 (sync)) | 960µs (x4.5 (sync)) |