feat: add raw base64 decoder

This commit is contained in:
Julien Oculi 2024-07-01 13:33:27 +02:00
parent b71d2c6aae
commit 1abc0d82c4

View file

@ -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)
}