el.xwx.moe/lib/client/fileExists.ts
2023-05-22 15:50:48 +03:30

10 lines
277 B
TypeScript

export default async function fileExists(fileUrl: string): Promise<boolean> {
try {
const response = await fetch(fileUrl, { method: "HEAD" });
return response.ok;
} catch (error) {
console.error("Error checking file existence:", error);
return false;
}
}