mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
10 lines
280 B
TypeScript
10 lines
280 B
TypeScript
export default async function URLToBase64(URL: string) {
|
|
const response = await fetch(URL);
|
|
const blob = await response.arrayBuffer();
|
|
const base64 = `data:${response.headers.get(
|
|
'content-type',
|
|
)};base64,${Buffer.from(blob).toString('base64')}`;
|
|
|
|
return base64;
|
|
}
|