el.xwx.moe/lib/client/avatarExists.ts
2023-05-24 02:37:26 +03:30

5 lines
210 B
TypeScript

export default async function avatarExists(fileUrl: string): Promise<boolean> {
const response = await fetch(fileUrl, { method: "HEAD" });
return !(response.headers.get("content-type") === "text/plain");
}