decode diff view for sparkplug

This commit is contained in:
Sinuhe Tellez
2021-08-08 16:32:22 -04:00
parent 68ef9ac913
commit 23b46cd432
4 changed files with 21 additions and 19 deletions

View File

@@ -27,4 +27,14 @@ export class Base64Message {
public static toDataUri(message: Base64Message, mimeType: string) {
return `data:${mimeType};base64,${message.base64Message}`
}
public static toUint8Array(message: Base64Message) {
var binary_string = window.atob(message.base64Message);
var len = binary_string.length;
var bytes = new Uint8Array(len);
for (var i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i);
}
return bytes
}
}