JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7172
  • Score
    100M100P100Q134829F
  • License MIT

Base32 encoder/decoder with support for multiple variants

Package Exports

  • @ctrl/ts-base32

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 (@ctrl/ts-base32) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ts-base32 npm build status coverage status

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://typectrl.github.io/ts-base32/

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