0.1.1 • Published 2 years ago
@sigma-db/lookpath v0.1.1
Lookpath
This package exports a single function lookpath
that operates similar to the commands which
and where
on UNIX and Windows, respectively, but does not need to spawn them as a child process (and parse their output), making the operation more performant.
Inspiration was drawn from https://golang.org/src/os/exec/lp_unix.go and https://golang.org/src/os/exec/lp_windows.go from the Go standard library.
Installation
Run npm i @sigma-db/lookpath
to install the package to your project's dependencies.
Usage
import { lookpath } from "@sigma-db/lookpath";
try {
const gitPath = await lookpath("git");
} catch {
// Command is either not in the environment's path or not executable...
}