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

Function DetectByContent

internal/files/files.go:180–191  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

178}
179
180func DetectByContent(data []byte) (string, error) {
181 mimeType := http.DetectContentType(data)
182
183 switch mimeType {
184 case "application/octet-stream", "text/plain":
185 return AnalyzeTextContent(data)
186 case "text/csv; charset=utf-8":
187 return "text/csv", nil
188 default:
189 return mimeType, nil
190 }
191}
192
193func AnalyzeTextContent(data []byte) (string, error) {
194 if LooksLikeCSV(data) {

Callers 1

DetectFileTypeFunction · 0.85

Calls 1

AnalyzeTextContentFunction · 0.85

Tested by

no test coverage detected