Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/encoding/base64url.ts

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
import * as mod from "https://deno.land/std@0.208.0/encoding/base64url.ts";

encodeBase64Url and decodeBase64Url for base64 URL safe encoding.

This module is browser compatible.

Examples

Example 1

import {
  decodeBase64Url,
  encodeBase64Url,
} from "https://deno.land/std@0.208.0/encoding/base64url.ts";

const binary = new TextEncoder().encode("foobar");
const encoded = encodeBase64Url(binary);
console.log(encoded);
// => "Zm9vYmFy"

console.log(decodeBase64Url(encoded));
// => Uint8Array(6) [ 102, 111, 111, 98, 97, 114 ]

Variables

v
decode
deprecated
v
encode
deprecated

Functions

Converts given base64url encoded data back to original

Encodes a given ArrayBuffer or string into a base64url representation