@strc/utf16-to-any-base
v2.0.2
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.This library mainly supports UTF-16 to Base64 and Base64 to UTF-16 conversions only. Other bases are unstable and experemental, in most cases they wont be decodable!
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);
console.log("Base64:", encoded, "\nUTF-16:", decode(encoded, 64));