Files
keycloak_theme/src/bin/tools/fs.existsAsync.ts
2024-02-11 18:28:58 +01:00

12 lines
278 B
TypeScript

import * as fs from "fs/promises";
export async function existsAsync(path: string) {
try {
await fs.stat(path);
return true;
} catch (error) {
if ((error as Error & { code: string }).code === "ENOENT") return false;
throw error;
}
}