MCPcopy Create free account
hub / github.com/experdot/pointer / getMimeType

Function getMimeType

src/renderer/src/hooks/useAttachment.ts:9–19  ·  view source on GitHub ↗
(fileName: string)

Source from the content-addressed store, hash-verified

7
8// 从文件名推断 MIME 类型
9function 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
22function generateId(): string {

Callers 2

useAttachmentFunction · 0.85
selectAndSaveAttachmentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected