MCPcopy Create free account
hub / github.com/TanStack/ai / arrayBufferToBase64

Function arrayBufferToBase64

packages/ai-fal/src/utils/client.ts:142–152  ·  view source on GitHub ↗
(bytes: ArrayBuffer)

Source from the content-addressed store, hash-verified

140 * Bun) or walk the byte array in a single loop (browser).
141 */
142export function arrayBufferToBase64(bytes: ArrayBuffer): string {
143 if (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {
144 return Buffer.from(bytes).toString('base64')
145 }
146 const view = new Uint8Array(bytes)
147 let binary = ''
148 for (const byte of view) {
149 binary += String.fromCharCode(byte)
150 }
151 return btoa(binary)
152}

Callers 1

transformResponseMethod · 0.90

Calls 2

toStringMethod · 0.80
fromMethod · 0.80

Tested by

no test coverage detected