MCPcopy Create free account
hub / github.com/chhoumann/quickadd / decodeFromBase64

Function decodeFromBase64

src/utils/base64.ts:41–54  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

39}
40
41export function decodeFromBase64(value: string): string {
42 if (textDecoder && hasWindowFunction("atob")) {
43 const binary = window.atob(value);
44 const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
45 return textDecoder.decode(bytes);
46 }
47
48 const buffer = getGlobalBuffer();
49 if (buffer) {
50 return buffer.from(value, "base64").toString("utf8");
51 }
52
53 throw new Error("Base64 decoding is not supported in this environment.");
54}

Callers 7

applyPackageImportFunction · 0.90
bundledScriptCodeFunction · 0.90
decodeAssetPreviewFunction · 0.90

Calls 2

hasWindowFunctionFunction · 0.85
getGlobalBufferFunction · 0.85

Tested by

no test coverage detected