Skip to content

Finds the path to the specified command in Deno.

License

Notifications You must be signed in to change notification settings

dsherret/deno-which

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deno-which

deno doc

Finds the path to the specified command.

> deno add @david/which
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:

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,
    });
  },
});

About

Finds the path to the specified command in Deno.

Resources

License

Stars

Watchers

Forks

Packages

No packages published