fix(toBase64): remove image-to-base64 dependencies

This commit is contained in:
Hexagonn authored and GitHub committed 2024-10-20 13:16:43 +00:00
1 parent be11864c21
commit c69691e7d5
4 files changed
+3499 -5

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
"use server";
// probably the messiest code i've ever written but it works so :)
import { Badges } from "#/public/assets/badges/BadgesEncoded";
+6 -3
View File
@@ -1,10 +1,13 @@
import imageToBase64 from "image-to-base64";
export const encodeBase64 = async (url: string): Promise<string> => {
let response = "";
try {
response = await imageToBase64(url);
response = await fetch(url)
.then((res) => res.blob())
.then(async (blob) => {
const buffer = Buffer.from(await blob.arrayBuffer());
return buffer.toString("base64");
});
} catch (e) {
console.log(e);
}