Encodingv1.0.0
@sopkit/base64
Premium Unicode-safe and URL-safe Base64 encoder and decoder for both Browser and Node.js.
Overview
Standard JavaScript btoa and atob functions fail on multi-byte UTF-8 Unicode characters (like Emojis). @sopkit/base64 fixes this natively, providing complete encoding safety and additional URL-Safe encoders.
Installation
npm install @sopkit/base64
Quick Start (ESM)
import { encode, decode, urlEncode, urlDecode } from "@sopkit/base64";
const enc = encode("SopKit 🚀"); // "U29wS2l0IPCZiQ=="
const dec = decode(enc); // "SopKit 🚀"API Reference
encode(input: string): stringEncodes string into standard Base64 representation.
decode(input: string): stringDecodes standard Base64 string back into UTF-8 representation.
urlEncode(input: string): stringEncodes string into URL-safe Base64 representation.
urlDecode(input: string): stringDecodes URL-safe Base64 representation.
Rivals Comparison
How @sopkit/base64 compares against the typical industry standard (js-base64):
Unicode Safe
Built-in (Native standard fix)Requires custom buffer hacks
URL Safe mode
Supported (urlEncode / urlDecode)Manual character replace needed
Bundle size
1.05 KB (minified)4.8 KB
SopKit Guarantee
All libraries in the SopKit ecosystem are guaranteed to have zero server calls, zero analytical trackers, and 100% client-side privacy-first execution.