mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-12 02:05:51 +00:00
24 lines
436 B
JavaScript
24 lines
436 B
JavaScript
|
|
||
|
const Base64 = {};
|
||
|
|
||
|
|
||
|
|
||
|
Base64.decode = function (string) {
|
||
|
|
||
|
const binaryString = atob(string);
|
||
|
const binaryLength = binaryString.length;
|
||
|
const bytes = new Uint8Array(binaryLength);
|
||
|
|
||
|
for (let i = 0; i < binaryLength; i++) {
|
||
|
bytes[i] = binaryString.charCodeAt(i);
|
||
|
}
|
||
|
|
||
|
const decoder = new TextDecoder();
|
||
|
const decodedString = decoder.decode(bytes);
|
||
|
return decodedString;
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
export default Base64;
|