MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / DetectFileType

Function DetectFileType

internal/files/files.go:168–173  ·  view source on GitHub ↗
(data []byte, filename string)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

DetectByExtensionFunction · 0.85
DetectByContentFunction · 0.85

Tested by

no test coverage detected