Skip to content

Instantly share code, notes, and snippets.

View dugrema's full-sized avatar
💭
Poutine

Mathieu Dugré dugrema

💭
Poutine
View GitHub Profile
@dugrema
dugrema / base64.js
Created November 27, 2019 01:40 — forked from enepomnyaschih/base64.js
Encode JS Uint8Array, simple array of bytes or native JS string to base64
const base64abc = (() => {
let abc = [],
A = "A".charCodeAt(0),
a = "a".charCodeAt(0),
n = "0".charCodeAt(0);
for (let i = 0; i < 26; ++i) {
abc.push(String.fromCharCode(A + i));
}
for (let i = 0; i < 26; ++i) {
abc.push(String.fromCharCode(a + i));