Setup project correctly for development and release

This commit is contained in:
2025-06-28 00:45:24 -05:00
parent ba36877f03
commit 5b73f1bb47
14 changed files with 3352 additions and 1902 deletions

View File

@@ -1,9 +1,7 @@
import { fetch } from 'undici'; // Node ≥18 has global fetch; otherwise add undici
export async function fetchAndEncode(url: string) {
const res = await fetch(url);
if (!res.ok) throw new Error(`Failed to fetch image: ${url}`);
const buf = Buffer.from(await res.arrayBuffer());
const mimeType = res.headers.get('content-type') || 'image/png';
const mimeType = res.headers.get('content-type') ?? 'image/png';
return { mimeType, data: buf.toString('base64') };
}