(data []byte, filename string)
| 166 | } |
| 167 | |
| 168 | func DetectFileType(data []byte, filename string) (string, error) { |
| 169 | if mimeType := DetectByExtension(filename); mimeType != "" { |
| 170 | return mimeType, nil |
| 171 | } |
| 172 | return DetectByContent(data) |
| 173 | } |
| 174 | |
| 175 | func DetectByExtension(filename string) string { |
| 176 | ext := strings.ToLower(filepath.Ext(filename)) |
no test coverage detected