Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

beeequeue/tinywhich

Open more actions menu

Repository files navigation

tinywhich

npm node >=16 install size bundle size

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.

Installation

pnpm
pnpm add tinywhich
yarn
yarn add tinywhich
npm
npm install tinywhich
bun
bun add tinywhich

Usage

import { which } from "tinywhich"
// const { which } = require("tinywhich")

which("node") // "[absolute path]/node"
which("notfound") // null

Comparison

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))
  • Benchmarks can be found in ./bench
  • Windows benchmark was run on 9800X3D + NVMe SSD, Node v22, with 44 directories in PATH, and default PATHEXT
  • Linux benchmark was run on a standard GH workflows runner

About

🔍 A tiny library for locating files in directories specified by `PATH`

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.