Skip to content

DimensionDev/coda

Repository files navigation

Coda Node.js CI

Make Codec Interesting Again. ([I:b])

Usages

import { Codec, encode, decode ) from "@dimensiondev/coda";

const decoded = decode("Maskbook", Codec.UTF8);

encode(decoded, Codec.Hexadecimal);     // '4d61736b626f6f6b'
encode(decoded, Codec.Base64);          // 'TWFza2Jvb2s='
encode(decoded, Codec.Base1024Emoji);   // '🐟🔂🏁🤖💧🚊😤'

Desc

All data will be formated into Uint8Array while we constructing the Codec class, for example, Let's format the word Mask!

Base1024Emoji

Text Binary Index
0x1f41f 0100110101 309
0x1f502 1000010111 535
0x1f3c1 0011011010 218
0x1f694 1100000000 768

UTF-8

Text Binary Index
M 01001101 77
a 01100001 97
s 01110011 115
k 01101011 107

Base64

Text Binary Index
T 010011 19
W 010110 22
F 000101 5
z 110011 51
a 011010 26
s 110000 48
= 000000

Hex

Text Binary Index
4 0100 4
d 1101 13
6 0110 6
1 0001 1
7 0111 7
3 0011 3
6 0110 6
b 1011 11

References

LICENSE

AGPL-3.0