(fileName: string)
| 7 | |
| 8 | // 从文件名推断 MIME 类型 |
| 9 | function getMimeType(fileName: string): string { |
| 10 | const ext = fileName.split('.').pop()?.toLowerCase() |
| 11 | const mimeMap: Record<string, string> = { |
| 12 | jpg: 'image/jpeg', |
| 13 | jpeg: 'image/jpeg', |
| 14 | png: 'image/png', |
| 15 | gif: 'image/gif', |
| 16 | webp: 'image/webp' |
| 17 | } |
| 18 | return mimeMap[ext || ''] || 'image/jpeg' |
| 19 | } |
| 20 | |
| 21 | // 生成唯一 ID |
| 22 | function generateId(): string { |
no outgoing calls
no test coverage detected