Map MIME type to file extension.
(mime: string)
| 1428 | |
| 1429 | /** Map MIME type to file extension. */ |
| 1430 | function mimeToExt(mime: string): string { |
| 1431 | const map: Record<string, string> = { |
| 1432 | 'image/png': '.png', 'image/jpeg': '.jpg', 'image/gif': '.gif', |
| 1433 | 'image/webp': '.webp', 'image/svg+xml': '.svg', 'image/avif': '.avif', |
| 1434 | 'video/mp4': '.mp4', 'video/webm': '.webm', 'video/quicktime': '.mov', |
| 1435 | 'audio/mpeg': '.mp3', 'audio/wav': '.wav', 'audio/ogg': '.ogg', |
| 1436 | 'application/pdf': '.pdf', 'application/json': '.json', |
| 1437 | 'text/html': '.html', 'text/plain': '.txt', |
| 1438 | }; |
| 1439 | return map[mime] || '.bin'; |
| 1440 | } |
no outgoing calls
no test coverage detected