(filePath: string)
| 11 | }; |
| 12 | |
| 13 | export function localFileToDataUri(filePath: string): string { |
| 14 | const ext = extname(filePath).toLowerCase(); |
| 15 | const mime = IMAGE_MIME_TYPES[ext] || 'image/jpeg'; |
| 16 | const data = readFileSync(filePath); |
| 17 | return `data:${mime};base64,${data.toString('base64')}`; |
| 18 | } |
| 19 | |
| 20 | export function resolveImageInput(input: string): string { |
| 21 | return input.startsWith('http') ? input : localFileToDataUri(input); |
no outgoing calls
no test coverage detected