Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/cli.ts>which

A JavaScript extension package for building strong and modern applications.
Latest
function which
import { which } from "https://deno.land/x/ayonli_jsext@v0.9.72/cli.ts";

Returns the path of the given command if it exists in the system, otherwise returns null.

This function is available in Windows as well.

Examples

Example 1

import { which } from "@ayonli/jsext/cli";

const path = await which("node");

console.log(path);
// e.g. "/usr/bin/node" in UNIX/Linux or "C:\\Program Files\\nodejs\\node.exe" in Windows

Parameters

cmd: string

Returns

Promise<string | null>