@strc/utf16-to-any-base
v1.0.0
Published
Encode JavaScript UTF-16 strings to arbitrary bases (Base64, Base32, etc.) and decode them back.
Readme
@strc/utf16-to-any-base
A simple, small, fast, ES lib to convert UTF-16 to any base.
Warning
This library does NOT implement standard Base64. Encoded strings are NOT compatible with
atob,btoa,Buffer.from(..., 'base64'), or other Base64 tools.
npm i @strc/utf16-to-any-baseThis is an internal module of JSSC (strc).
npm i strcUsage
import { encode, decode } from "@strc/utf16-to-any-base";
const encoded = encode("Hello, world!", 64); // returns "1Pu++nMttDPVQmwHZy0pCWg\viKqXttAA"
console.log("Base64:", encoded, "\nUTF-16:", decode(encoded, 64));