* Get file extension from MIME type
(mimeType: string)
| 237 | * Get file extension from MIME type |
| 238 | */ |
| 239 | function getExtensionFromMimeType(mimeType: string): string { |
| 240 | const mimeToExt: Record<string, string> = { |
| 241 | // Video |
| 242 | 'video/mp4': 'mp4', |
| 243 | 'video/quicktime': 'mov', |
| 244 | 'video/x-msvideo': 'avi', |
| 245 | 'video/x-matroska': 'mkv', |
| 246 | 'video/webm': 'webm', |
| 247 | // Audio |
| 248 | 'audio/mpeg': 'mp3', |
| 249 | 'audio/mp4': 'm4a', |
| 250 | 'audio/wav': 'wav', |
| 251 | 'audio/webm': 'webm', |
| 252 | 'audio/ogg': 'ogg', |
| 253 | 'audio/flac': 'flac', |
| 254 | 'audio/aac': 'aac', |
| 255 | 'audio/opus': 'opus', |
| 256 | } |
| 257 | |
| 258 | return mimeToExt[mimeType] || mimeType.split('/')[1] || 'dat' |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Get appropriate audio codec for output format |
no outgoing calls
no test coverage detected