(data []byte)
| 178 | } |
| 179 | |
| 180 | func 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 | |
| 193 | func AnalyzeTextContent(data []byte) (string, error) { |
| 194 | if LooksLikeCSV(data) { |
no test coverage detected