Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NormanTUD committed Sep 26, 2024
1 parent 817cc28 commit ad652a1
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
"use strict";

function blobToBase64(blobString) {
// Erstelle ein Blob-Objekt aus dem gegebenen Blob-String
const blob = new Blob([blobString]);

// Erstelle ein FileReader-Objekt
const reader = new FileReader();

// Erstelle eine Promise, die das Ergebnis zurückgibt
return new Promise((resolve, reject) => {
// Wenn der Lesevorgang abgeschlossen ist
reader.onloadend = () => {
if (reader.error) {
// Im Falle eines Fehlers, logge und warne
console.warn("Error reading a blob: ", reader.error);
reject(reader.error);
} else {
// Konvertiere das Blob in Base64 und gib es zurück
const base64String = reader.result.split(",")[1];
resolve(base64String);
}
};

// Lese den Blob als Data-URL
reader.readAsDataURL(blob);
});
}
Expand Down

0 comments on commit ad652a1

Please sign in to comment.