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

Function AnalyzeTextContent

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

Source from the content-addressed store, hash-verified

191}
192
193func AnalyzeTextContent(data []byte) (string, error) {
194 if LooksLikeCSV(data) {
195 return "text/csv", nil
196 }
197 if json.Valid(data) {
198 return "application/json", nil
199 }
200 return "text/plain", nil
201}
202
203func LooksLikeCSV(data []byte) bool {
204 lines := bytes.Split(data, []byte("\n"))

Callers 1

DetectByContentFunction · 0.85

Calls 1

LooksLikeCSVFunction · 0.85

Tested by

no test coverage detected