Oslo

Base64Encoding

Radix 64 encoding/decoding scheme. Characters are case sensitive. Use base64 or base64url for Base 64 encoding based on RFC 4648.

Constructor

function constructor(alphabet: string): this;

Parameters

  • alphabet: A string of 64 characters

Methods

Example

import { Base64Encoding } from "oslo/encoding";

const base64 = new Base64Encoding(
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
);
const encoded = base64.encode(new Uint8Array(8));
const decoded = base64.encode(encoded);