mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Add metadata read/write support for Ogg
This commit is contained in:
+21
@@ -702,3 +702,24 @@ export const imageMimeTypeToExtension = (mimeType: string) => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const base64ToBytes = (base64: string) => {
|
||||
const decoded = atob(base64);
|
||||
const bytes = new Uint8Array(decoded.length);
|
||||
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
bytes[i] = decoded.charCodeAt(i);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
};
|
||||
|
||||
export const bytesToBase64 = (bytes: Uint8Array) => {
|
||||
let string = '';
|
||||
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
string += String.fromCharCode(bytes[i]!);
|
||||
}
|
||||
|
||||
return btoa(string);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user