MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / GetMimeTypeByExtension

Function GetMimeTypeByExtension

service/file_decoder.go:88–135  ·  view source on GitHub ↗
(ext string)

Source from the content-addressed store, hash-verified

86}
87
88func GetMimeTypeByExtension(ext string) string {
89 // Convert to lowercase for case-insensitive comparison
90 ext = strings.ToLower(ext)
91 switch ext {
92 // Text files
93 case "txt", "md", "markdown", "csv", "json", "xml", "html", "htm":
94 return "text/plain"
95
96 // Image files
97 case "jpg", "jpeg":
98 return "image/jpeg"
99 case "png":
100 return "image/png"
101 case "gif":
102 return "image/gif"
103
104 // Audio files
105 case "mp3":
106 return "audio/mp3"
107 case "wav":
108 return "audio/wav"
109 case "mpeg":
110 return "audio/mpeg"
111
112 // Video files
113 case "mp4":
114 return "video/mp4"
115 case "wmv":
116 return "video/wmv"
117 case "flv":
118 return "video/flv"
119 case "mov":
120 return "video/mov"
121 case "mpg":
122 return "video/mpg"
123 case "avi":
124 return "video/avi"
125 case "mpegps":
126 return "video/mpegps"
127
128 // Document files
129 case "pdf":
130 return "application/pdf"
131
132 default:
133 return "application/octet-stream" // Default for unknown types
134 }
135}

Callers 1

GetFileBase64FromUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected