A Node.js implementation of the Unix which command to find executables in the PATH.
node-which is a Node.js library that finds the first instance of a specified executable in the system's PATH environment variable, similar to the Unix `which` command. It solves the problem of programmatically locating executables in cross-platform environments, ensuring scripts and tools can reliably find necessary binaries. The library provides both asynchronous and synchronous APIs, along with options for custom PATH overrides and returning all matches.
Node.js developers and DevOps engineers who need to programmatically find executables in build scripts, CLI tools, or automation workflows. It's particularly useful for those working in cross-platform environments where PATH resolution varies.
Developers choose node-which for its Unix-like accuracy, seamless Node.js integration, and flexibility with async/sync APIs. Its no-caching design ensures reliable results when PATH changes, and the included CLI tool offers direct terminal usage, making it a versatile choice for executable discovery.
Like which(1) unix command. Find the first instance of an executable in the PATH.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Mirrors the standard Unix which utility, ensuring reliable and familiar behavior for executable discovery, as stated in the project's philosophy.
Provides both asynchronous and synchronous methods, allowing flexibility for different programming needs, as demonstrated in the usage examples with await and sync calls.
Supports overriding PATH and PATHEXT via options, enabling use in varied or custom environments, detailed in the OPTIONS section.
Does not cache results, guaranteeing accuracy when PATH changes without requiring manual cache invalidation, as highlighted in the description.
Includes a command-line interface that mimics BSD which(1), useful for direct terminal usage, as explained in the CLI USAGE section.
Lacks built-in type definitions, requiring developers to add them manually or rely on community packages for TypeScript projects, which adds setup overhead.
The binary is named `node-which` instead of `which`, which can confuse users expecting standard Unix commands, as noted in the README with a link to an explanation.
Focuses solely on path resolution without support for caching, executable version management, or deeper permission checks, limiting utility in complex automation scenarios.