AphrodyBun GitHub

Runtime docs · Guides · Utilities

Get the path to an executable bin file

Find the absolute path of an executable on the PATH with Bun.which(), like the Unix which command.

Bun.which finds the absolute path of an executable file, like the which command on Unix-like systems.

foo.ts
Bun.which("sh"); // => "/bin/sh"
Bun.which("notfound"); // => null
Bun.which("bun"); // => "/home/user/.bun/bin/bun"

See Bun.which.