(data []byte)
| 191 | } |
| 192 | |
| 193 | func 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 | |
| 203 | func LooksLikeCSV(data []byte) bool { |
| 204 | lines := bytes.Split(data, []byte("\n")) |
no test coverage detected