Something went wrong. Try again.
🌿 Collaborative wiki on ATProto forked from juprodh.me/lichen.wiki
Something went wrong. Try again.
1234567891011121314151617181920212223242526const IMAGE_TYPES = [ { mime: "image/jpeg", ext: ".jpg", aliases: [".jpeg"] }, { mime: "image/png", ext: ".png" }, { mime: "image/gif", ext: ".gif" }, { mime: "image/webp", ext: ".webp" },] as const;
export const MIME_TO_EXT: Record<string, string> = Object.fromEntries( IMAGE_TYPES.map((t) => [t.mime, t.ext.slice(1)]),);
export const IMAGE_EXTENSIONS: Set<string> = new Set( IMAGE_TYPES.flatMap((t) => "aliases" in t ? [t.ext, ...t.aliases] : [t.ext], ),);
export const MIME_BY_EXT: Record<string, string> = Object.fromEntries( IMAGE_TYPES.flatMap((t) => { const entries: [string, string][] = [[t.ext, t.mime]]; if ("aliases" in t) for (const alias of t.aliases) entries.push([alias, t.mime]); return entries; }),);