logo

Base64

This is a collection of functions for working with base64.

Encode

The encodeBase64 function encodes an array of integers into a base64 string.

import { encodeBase64 } from '@aracna/core';

// will log "aGVsbG8="
console.log(encodeBase64([104, 101, 108, 108, 111]));

Decode

The decodeBase64 function decodes a base64 string into a Uint8Array.

import { decodeBase64 } from '@aracna/core';

// will log [104, 101, 108, 108, 111]
console.log(decodeBase64('aGVsbG8='));

Encode URL

The encodeBase64URL function encodes an array of integers into a base64 URL string.

import { encodeBase64URL } from '@aracna/core';

// will log "aGVsbG8"
console.log(encodeBase64URL([104, 101, 108, 108, 111]));

Decode URL

The decodeBase64URL function decodes a base64 URL string into a Uint8Array.

import { decodeBase64URL } from '@aracna/core';

// will log [104, 101, 108, 108, 111]
console.log(decodeBase64URL('aGVsbG8'));