Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@oslojs/encoding

oslo-project1.1mMIT1.1.0TypeScript support: included

Runtime-agnostic library for encoding and decoding data

auth, encoding, hex, base16, base32, base64, base64url

readme

@oslojs/encoding

Documentation: https://encoding.oslojs.dev

A JavaScript library for encoding and decoding data with hexadecimal, base32, base64, and base64url encoding schemes based on RFC 4648. Implementations may be stricter than most to follow the RFC as close as possible.

  • Runtime-agnostic
  • No third-party dependencies
  • Fully typed
import { encodeBase64, decodeBase64 } from "@oslojs/encoding";

const data: Uint8Array = new TextEncoder().encode("hello world");
const encoded = encodeBase64(data);
const decoded = decodeBase64(encoded);

Installation

npm i @oslojs/encoding

changelog

@oslojs/encoding

1.1.0

  • Add encodeBase32UpperCase(), encodeBase32UpperCaseNoPadding(), encodeBase32LowerCase(), and encodeBase32LowerCaseNoPadding().

1.0.0

  • No changes.

0.4.1

  • Remove redundant code.

0.4.0

  • [Breaking] Replace base64, bas64url, and base32
  • [Breaking] Remove base32
  • [Breaking] Replace encodeHex() with encodeHexLowerCase() and encodeHexUpperCase().
  • [Breaking] Remove Encoding interface.

0.3.0

  • [Breaking] Add Encoding.encodeNoPadding() and Encoding.decodeIgnorePadding()
  • [Breaking] Remove includingPadding option from Base64Encoding.encode() and Base32Encoding.encode()
  • [Breaking] Remove strict option from Base64Encoding.decodeIgnorePadding() and Base32Encoding.decodeIgnorePadding()
  • Add Encoding.encodeNoPadding(), Base64Encoding.encodeNoPadding(), Base32Encoding.encodeNoPadding()
  • Add Encoding.decodeIgnorePadding(), Base64Encoding.decodeIgnorePadding(), Base32Encoding.decodeIgnorePadding()