MCPcopy Create free account
hub / github.com/pollinations/pollinations / wrapAudioResponse

Function wrapAudioResponse

packages/sdk/src/extras.ts:140–150  ·  view source on GitHub ↗
(
    response: AudioBinaryResponse,
)

Source from the content-addressed store, hash-verified

138
139/** Wrap audio response with helper methods */
140export function wrapAudioResponse(
141 response: AudioBinaryResponse,
142): AudioResponseExt {
143 return {
144 ...response,
145 saveToFile: (path: string) => saveBufferToFile(response.buffer, path),
146 toBase64: () => arrayBufferToBase64(response.buffer),
147 toDataURL: () =>
148 `data:${response.contentType};base64,${arrayBufferToBase64(response.buffer)}`,
149 };
150}
151
152/** Wrap chat response with extra metadata */
153export function wrapChatResponse(response: ChatResponse): ChatResponseExt {

Callers 1

generateAudioFunction · 0.85

Calls 2

saveBufferToFileFunction · 0.85
arrayBufferToBase64Function · 0.70

Tested by

no test coverage detected