about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/utils/base64.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/flavours/glitch/utils/base64.js')
-rw-r--r--app/javascript/flavours/glitch/utils/base64.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/utils/base64.js b/app/javascript/flavours/glitch/utils/base64.js
new file mode 100644
index 000000000..8226e2c54
--- /dev/null
+++ b/app/javascript/flavours/glitch/utils/base64.js
@@ -0,0 +1,10 @@
+export const decode = base64 => {
+  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;
+};