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

Function buildDataBASE64

src/utils.ts:68–75  ·  view source on GitHub ↗
(type: string, ext: string, buffer: ArrayBuffer)

Source from the content-addressed store, hash-verified

66}
67
68export function buildDataBASE64(type: string, ext: string, buffer: ArrayBuffer): string {
69 const bytes = new Uint8Array(buffer);
70 let binary = "";
71 for (let i = 0; i < bytes.byteLength; i++) {
72 binary += String.fromCharCode(bytes[i]);
73 }
74 return `data:${type}/${ext.replace("jpg", "jpeg")};base64,${btoa(binary)}`;
75}
76
77const MIME_MAP: Record<string, string> = {
78 jpg: "image/jpeg",

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected