From 1abc0d82c41f930fb19cd1ee5eda09a1b1b003fb Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Mon, 1 Jul 2024 13:33:27 +0200 Subject: [PATCH] feat: :sparkles: add raw base64 decoder --- src/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index a32485c..127fa3f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,5 @@ import { JsonValue } from '$std/json/common.ts' +import { decodeBase64 } from "@std/encoding/base64" export type JsonCompatible = JsonValue | { toJSON(): JsonValue } | unknown @@ -77,3 +78,8 @@ function getCookie(name: string): string | undefined { const cookies = Object.fromEntries(cookiesEntries) return cookies[name] } + +export function base64ToString(base64: string): string { + const bytes = decodeBase64(base64) + return new TextDecoder().decode(bytes) +} \ No newline at end of file