Clockwork Base32 encode/decode for TypeScript
npm i @niyari/base32-clockwork-ts
https://niyari.github.io/base32-ts/demo/
const base32_clockwork = new Base32Clockwork();
base32_clockwork.encode('foobar');
// str = "CSQPYRK1E8"
base32_clockwork.decode('CSQPYRK1E8');
// str = "foobar"
In decoding, the misleading character "IiLl" is treated as 1 and "Oo" is treated as 0.
base32_clockwork.decode('CSQPYRKlE8'); // 1 -> l
// str = "foobar"
base32_clockwork.encode('Tofu on Fire!📛'); // (📛 = Name Badge:for Japanese preschoolers.)
// str = "AHQPCX90DXQ20HK9E9JJ3W4ZJEDG"
base32_clockwork.decode("AHQPCX90DXQ20HK9E9JJ3W4ZJEDG");
// str = "Tofu on Fire!📛"
new Base32Clockwork([{ [padding] [,raw] }]);
{ padding: <bool> }
const b32_cw_pad = new Base32Clockwork({ padding: true });
b32_cw_pad.encode('foobar');
// str = "CSQPYRK1E8======"
Return Uint8Array object.
{ raw: <bool> }
const b32_cw = new Base32Clockwork();
b32_cw_.decode('CSQPYRK1E8'); // (default)
const b32_cw_raw0 = new Base32Clockwork({ raw: false });
b32_cw_raw0.decode('CSQPYRK1E8');
// Return value: String
const b32_cw_raw1 = new Base32Clockwork({ raw: true });
b32_cw_raw1.decode('CSQPYRK1E8');
// Return value: Uint8Array object
MIT