@ctrl/ts-base32
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

ts-base32 npm CircleCI coverage bundlesize

Base32 encode and decode in typescript exported as both commonjs and tree shakeable modules. Support for RFC4648, RFC4648_HEX, and CROCKFORD base32 encoding. Mostly directly taken from LinusU's packages.

Demo: https://ts-base32.vercel.app

Install

npm install @ctrl/ts-base32

Use

import { base32Encode, base32Decode } from '@ctrl/ts-base32';

console.log(base32Encode(Buffer.from('a')));
// 'ME======'

console.log(base32Encode(Buffer.from('a'), { padding: false }));
// 'ME'

console.log(base32Decode('ME======'));
// ArrayBuffer { byteLength: 1 }

console.log(Buffer.from(base32Decode('ME======')).toString());
// 'a'

See Also

base32-encode - https://github.com/LinusU/base32-encode
base32-decode - https://github.com/LinusU/base32-decode
hex-to-array-buffer - https://github.com/LinusU/hex-to-array-buffer

Install

npm i @ctrl/ts-base32

DownloadsWeekly Downloads

629

Version

2.1.2

License

MIT

Unpacked Size

8.4 kB

Total Files

5

Last publish

Collaborators

  • scttcper