MCPcopy
hub / github.com/simstudioai/sim / decodeBase64Text

Function decodeBase64Text

apps/sim/providers/attachments.ts:262–268  ·  view source on GitHub ↗
(base64: string, filename: string)

Source from the content-addressed store, hash-verified

260}
261
262function decodeBase64Text(base64: string, filename: string): string {
263 try {
264 return Buffer.from(base64, 'base64').toString('utf8')
265 } catch {
266 throw new Error(`File "${filename}" could not be decoded as UTF-8 text`)
267 }
268}
269
270function toDataUrl(mimeType: string, base64: string): string {
271 return `data:${mimeType};base64,${base64}`

Callers 1

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected