Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-04T17:47:52.000Z (8 months ago)
- Last Synced: 2024-10-30T09:01:42.158Z (2 months ago)
- Language: TypeScript
- Size: 13.7 KB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deno-which
[![deno doc](https://jsr.io/badges/@david/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,
});
},
});
```