visionary-base64url
v0.1.2
Published
A lightweight library for URL-safe Base64 encoding and decoding.
Downloads
2,536
Maintainers
Readme
visionary-base64url
A lightweight base64url converter for Node.js, web browsers, and worker environments. Built on js-base64 for broad compatibility and automatic runtime detection.
Install
npm install visionary-base64url
yarn add visionary-base64urlUsage
Encode text as base64url
import { encodeBase64Url } from "visionary-base64url";
const encoded = encodeBase64Url("The quick brown fox jumps over the lazy dog.");
console.log(encoded);
// VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4Decode base64url-encoded string to plain text
import { decodeBase64Url } from "visionary-base64url";
const decoded = decodeBase64Url("aHR0cHM6Ly93d3cuc3BhY2V4LmNvbS92ZWhpY2xlcy9zdGFyc2hpcA");
console.log(decoded);
// https://www.spacex.com/vehicles/starshipWhat is base64url?
base64url is a web-safe variant of Base64 encoding. It replaces problematic characters (+, =, /) with URL and filename-friendly alternatives (_, -), as defined in RFC 4648.
Why use base64url?
Use base64url for portable, URL-safe encoding of text or JSON data, making it ideal for environments where standard Base64 might break things. Safely drop it into contexts like:
- URL paths and query parameters — embed data directly in URLs
- Filesystem-friendly — safe for filenames and blob storage keys
- Shell scripts and CI pipelines — avoid quoting or escaping issues in command-line tools and automation workflows
- JWTs and web tokens — compliant with RFC 7515 (JWS compact serialization)
