glitchier-soc/app/javascript/flavours/glitch/utils/base64.ts

11 lines
269 B
TypeScript
Raw Normal View History

export const decode = (base64: string): Uint8Array => {
2018-08-23 23:02:42 +03:00
const rawData = window.atob(base64);
const outputArray = new Uint8Array(rawData.length);
for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
};