INNER CODE UNIT · TypeScript
exists
rit3zh/reacticx · cloudflare/cli/index.ts:172
const exists = (path: string) =>
access(path).then(
() => true,
() => false,
);
/** Whether `name` resolves on PATH. */
function onPath(name: string) {
return new Promise<boolean>((resolve) => {
const child = spawn("which", [name], { stdio: "ignore" });
child.on("error", () => resolve(false));
child.on("close", (code) => resolve(code === 0));
});
}
/* -------------------------------------------------------------------------- */
/* push / status */
/* -------------------------------------------------------------------------- */