IsTextFile returns true if file content format is plain text or empty.
(data []byte)
| 9 | |
| 10 | // IsTextFile returns true if file content format is plain text or empty. |
| 11 | func IsTextFile(data []byte) bool { |
| 12 | if len(data) == 0 { |
| 13 | return true |
| 14 | } |
| 15 | return strings.Contains(http.DetectContentType(data), "text/") |
| 16 | } |
| 17 | |
| 18 | func IsImageFile(data []byte) bool { |
| 19 | return strings.Contains(http.DetectContentType(data), "image/") |
no outgoing calls
no test coverage detected