el.xwx.moe/lib/client/avatarExists.ts

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");
}