MCPcopy Create free account
hub / github.com/TQZHR/grok2api / arrayBufferToBase64

Function arrayBufferToBase64

src/utils/base64.ts:1–9  ·  view source on GitHub ↗
(buf: ArrayBuffer)

Source from the content-addressed store, hash-verified

1export function arrayBufferToBase64(buf: ArrayBuffer): string {
2 const bytes = new Uint8Array(buf);
3 let binary = "";
4 const chunkSize = 0x8000;
5 for (let i = 0; i < bytes.length; i += chunkSize) {
6 binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize));
7 }
8 return btoa(binary);
9}
10

Callers 3

fetchImageAsBase64Function · 0.90
openai.tsFile · 0.90
uploadImageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected