base32-encode

Base32 encoder with support for multiple variants.

MIT 7 个版本
安装
npm install base32-encode
yarn add base32-encode
pnpm add base32-encode
bun add base32-encode
README

Base32 Encode

Base32 encoder with support for multiple variants.

Installation

npm install --save base32-encode

Usage

import base32Encode from 'base32-encode'
const data = new Uint8Array([0x74, 0x65, 0x73, 0x74])

console.log(base32Encode(data, 'Crockford'))
//=> EHJQ6X0

console.log(base32Encode(data, 'RFC4648'))
//=> ORSXG5A=

console.log(base32Encode(data, 'RFC4648', { padding: false }))
//=> ORSXG5A

console.log(base32Encode(data, 'RFC4648-HEX'))
//=> EHIN6T0=

API

base32Encode(data, variant[, options])

  • data (ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray, required)
  • variant ('RFC3548' | 'RFC4648' | 'RFC4648-HEX' | 'Crockford', required)
  • options (object, optional)
    • padding (boolean, optional) - If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant.
  • returns string

Encode the data in data into a Base32 encoded string.

Variants

See also

版本列表
2.0.0 2021-07-24
1.2.0 2021-03-30
1.1.1 2019-02-26
1.1.0 2018-06-25
1.0.0 2017-12-14
0.1.1 2017-12-14
0.1.0 2016-08-21