@utopia-utils/cli
Version:
Collection of common cli utils
17 lines (15 loc) • 360 B
text/typescript
import { access } from 'node:fs/promises'
/**
* It returns true if the path exists, and false if it doesn't
* @param {string} path - The path to check.
* @returns A promise that resolves to a boolean.
*/
export async function pathExists(path: string): Promise<boolean> {
try {
await access(path)
return true
}
catch {
return false
}
}