(base64: string, filename: string)
| 260 | } |
| 261 | |
| 262 | function 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 | |
| 270 | function toDataUrl(mimeType: string, base64: string): string { |
| 271 | return `data:${mimeType};base64,${base64}` |
no test coverage detected