Package Exports
- @niyari/base32-clockwork-ts
- @niyari/base32-clockwork-ts/dist/base32-cw.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@niyari/base32-clockwork-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
base32-clockwork-ts
Clockwork Base32 encode/decode for TypeScript
Install
npm i @niyari/base32-clockwork-tsDemo
https://niyari.github.io/base32-ts/demo/
Usage
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"Encoding multibyte character set
base32_clockwork.encode('Tofu on Fire!📛'); // (📛 = Name Badge:for Japanese preschoolers.)
// str = "AHQPCX90DXQ20HK9E9JJ3W4ZJEDG"
base32_clockwork.decode("AHQPCX90DXQ20HK9E9JJ3W4ZJEDG");
// str = "Tofu on Fire!📛"API(Options)
new Base32Clockwork([{ [padding] [,raw] }]);Encode: Set padding ( = )
{ padding: <bool> }const b32_cw_pad = new Base32Clockwork({ padding: true });
b32_cw_pad.encode('foobar');
// str = "CSQPYRK1E8======"Decode: Raw
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 objectSee Also:
License
MIT