feat: rename to blitzrinth

This commit is contained in:
TrèsAbhi committed 2024-04-20 12:00:48 -05:00
1 parent 0fd17d9c96
commit c2b936c925
213 files changed
+314 -307

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import sharp from 'sharp';
const cache: Record<string, Buffer> = {};
export async function webpToPng(url: string) {
if (!url.endsWith('.webp')) return url;
if (!cache[url]) {
const imageResponse = await fetch(url);
const imageBufferWEBP = await imageResponse.arrayBuffer();
const imageBufferPNG = await sharp(imageBufferWEBP).png().toBuffer();
cache[url] = imageBufferPNG;
}
return `data:image/png;base64,${cache[url].toString('base64')}`;
}