encodeBase64Url
function encodeBase64Url(str): string;Defined in: cursor-codec.ts:75
Encode a UTF-8 string as base64url (no padding). Unlike btoa, handles
non-Latin1 input; unlike Buffer, works in browsers and edge runtimes.
The default encoder of createCursorCodec; reverse with decodeBase64Url.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
str |
string |
Returns
Section titled “Returns”string
Example
Section titled “Example”import { encodeBase64Url } from "@xtandard/lib/pagination";
encodeBase64Url('{"id":7}'); // "eyJpZCI6N30"encodeBase64Url("café ☕"); // "Y2Fmw6kg4piV"