https://github.com/dsherret/deno-which
Finds the path to the specified command in Deno.
https://github.com/dsherret/deno-which
Last synced: 2 months ago
JSON representation
Finds the path to the specified command in Deno.
- Host: GitHub
- URL: https://github.com/dsherret/deno-which
- Owner: dsherret
- License: mit
- Created: 2022-01-05T17:16:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-04T17:47:52.000Z (about 1 year ago)
- Last Synced: 2025-05-05T20:09:43.411Z (2 months ago)
- Language: TypeScript
- Size: 13.7 KB
- Stars: 16
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deno-which
[](https://jsr.io/@david/which)
Finds the path to the specified command.
```sh
> deno add @david/which
``````ts
import { which, whichSync } from "@david/which";const pathToCurl = await which("curl");
```## Custom Environment
If you want to use this with an fake or in memory environment, then you can
provide a custom environment as the second parameter.For example:
```ts
const pathToCurl = await which("curl", {
os: "windows",
async fileExists(filePath: string) {
// implement this
},
env(key: string) {
// implement getting an environment variable
},
// optional method for requesting broader permissions for a folder
requestPermission(folderPath: string): void {
Deno.permissions.requestSync({
name: "read",
path: folderPath,
});
},
});
```