@dataroadinc/setup-auth
Version:
CLI tool and programmatic API for automated OAuth setup across cloud platforms
16 lines (15 loc) • 374 B
JavaScript
import { access, constants, unlink } from "node:fs/promises";
export async function fileExists(filePath) {
try {
await access(filePath, constants.R_OK | constants.W_OK);
return true;
}
catch {
return false;
}
}
export async function deleteFile(filePath) {
if (await fileExists(filePath)) {
await unlink(filePath);
}
}