Buffer
Buffer base64url encoding
Encodes bytes using the URL-safe Base64 alphabet without output padding. This is reversible encoding, not secrecy or integrity. Tested on Node.js 22.16.0. Example output (one line per entry): ["-_8 true"].
Formal Syntax & Structure
nodejs syntaxnodejs
Buffer.from(text, 'base64url'); bytes.toString('base64url')Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| text | string | Encoded input for decoding. |
| bytes | Buffer | Bytes to encode. |
Return Value
Buffer | string
Decoded bytes or encoded string.
Working Example
Example Snippetnodejs
const b = Buffer.from([251, 255]);const s = b.toString('base64url');console.log(s, Buffer.from(s, 'base64url').equals(b));