urlUtils: base64 to Blob

This commit is contained in:
Enrico Ros
2025-04-25 15:25:11 -07:00
parent b90919a4df
commit 8c0868418c
+5
View File
@@ -192,6 +192,11 @@ export function base64ToArrayBuffer(base64Data: string) {
return base64ToUint8Array(base64Data).buffer;
}
export function base64ToBlob(base64Data: string, mimeType: string) {
const buffer = Buffer.from(base64Data, 'base64');
return new Blob([buffer], { type: mimeType });
}
/**
* Creates a Blob Object URL (that can be opened in a new tab with window.open, for instance) from a Data URL