Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.24 KB

README.md

File metadata and controls

36 lines (23 loc) · 1.24 KB

visionary-base64url

NPM version GitHub Actions Workflow Status NPM bundle size NPM Downloads

A cross-platform base64url converter for Node.js, web browsers, and worker environments. Tiny wrapper for js-base64 which leverages TextEncoder, atob, or Buffer based on runtime availability.

Install

npm install visionary-base64url
yarn add visionary-base64url

Usage

Encode a URL-safe Base64

import { encodeBase64Url } from "visionary-base64url";

const encoded = encodeBase64Url("The quick brown fox jumps over the lazy dog.");

console.log(encoded);
// -> VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4

Decode a Base64URL

import { decodeBase64Url } from "visionary-base64url";

const decoded = decodeBase64Url("aHR0cHM6Ly93d3cuc3BhY2V4LmNvbS92ZWhpY2xlcy9zdGFyc2hpcA");

console.log(decoded);
// -> https://www.spacex.com/vehicles/starship