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 -2
View File
@@ -8,11 +8,10 @@
"start": "next start",
"lint": "next lint"
},
"packageManager": "[email protected]",
"dependencies": {
"@types/escape-html": "^1.0.4",
"@types/image-to-base64": "^2.1.2",
"escape-html": "^1.0.3",
"image-to-base64": "^2.2.0",
"ioredis": "^5.4.1",
"next": "14.2.15",
"react": "^18",
+3491
View File
File diff suppressed because it is too large. Load diff
+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);
}