forked from Blendman974/faceclaw
Add a notification-icons database (from Pebble) for iOS
This commit is contained in:
1 parent
f47d82b871
commit
35a4ae7064
20 files changed
+1236
-102
No files matched your search
@@ -0,0 +1,19 @@
|
||||
const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
/** Decode standard base64 (padding and whitespace ignored), without relying on atob or Buffer. */
|
||||
export function decodeBase64(text: string): Uint8Array {
|
||||
const clean = text.replace(/[^A-Za-z0-9+/]/g, "");
|
||||
const out = new Uint8Array(Math.floor((clean.length * 3) / 4));
|
||||
let bits = 0;
|
||||
let bitCount = 0;
|
||||
let outIndex = 0;
|
||||
for (let i = 0; i < clean.length; i++) {
|
||||
bits = (bits << 6) | BASE64_ALPHABET.indexOf(clean[i]!);
|
||||
bitCount += 6;
|
||||
if (bitCount >= 8) {
|
||||
bitCount -= 8;
|
||||
out[outIndex++] = (bits >> bitCount) & 0xff;
|
||||
}
|
||||
}
|
||||
return out.subarray(0, outIndex);
|
||||
}
|
||||
Reference in new issue
Block a user