MCPcopy Create free account
hub / github.com/Hello-Application-XH/HelloGML / fetchFileBASE64

Function fetchFileBASE64

src/utils.ts:44–53  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

42}
43
44export async function fetchFileBASE64(url: string): Promise<string> {
45 const response = await fetch(url);
46 const arrayBuffer = await response.arrayBuffer();
47 const bytes = new Uint8Array(arrayBuffer);
48 let binary = "";
49 for (let i = 0; i < bytes.byteLength; i++) {
50 binary += String.fromCharCode(bytes[i]);
51 }
52 return btoa(binary);
53}
54
55export function isBASE64Data(value: string): boolean {
56 return typeof value === "string" && /^data:/.test(value);

Callers

nothing calls this directly

Calls 1

fetchFunction · 0.85

Tested by

no test coverage detected