Remove duplicated helper functions, move them to utils package

This commit is contained in:
Deluan
2020-06-24 18:12:23 -04:00
committed by Deluan Quintão
parent bb9a7fadc0
commit eb109ebeb4
5 changed files with 61 additions and 21 deletions
+17
View File
@@ -0,0 +1,17 @@
package utils
import (
"mime"
"path/filepath"
"strings"
)
func IsAudioFile(filePath string) bool {
extension := filepath.Ext(filePath)
return strings.HasPrefix(mime.TypeByExtension(extension), "audio/")
}
func IsImageFile(filePath string) bool {
extension := filepath.Ext(filePath)
return strings.HasPrefix(mime.TypeByExtension(extension), "image/")
}