aboutsummaryrefslogtreecommitdiff
path: root/pkg/fileop/file.go
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-01 17:55:50 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-01 17:55:50 +0200
commit6e84441dab0a2b89869e33d7e89d14189d9b67c0 (patch)
treee015839d495bcfc7619f4efd08f97a1ba603fd82 /pkg/fileop/file.go
parent3f0dc691e2248cc21edd2e74a62b8f28ce95559e (diff)
downloadlens-6e84441dab0a2b89869e33d7e89d14189d9b67c0.tar.gz
lens-6e84441dab0a2b89869e33d7e89d14189d9b67c0.tar.bz2
lens-6e84441dab0a2b89869e33d7e89d14189d9b67c0.zip
feat: Add thumbnailer
Diffstat (limited to 'pkg/fileop/file.go')
-rw-r--r--pkg/fileop/file.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/fileop/file.go b/pkg/fileop/file.go
new file mode 100644
index 0000000..07c08e5
--- /dev/null
+++ b/pkg/fileop/file.go
@@ -0,0 +1,17 @@
+package fileop
+
+import (
+ "crypto/md5"
+ "encoding/hex"
+ "strings"
+)
+
+func GetHashFromPath(path string) string {
+ hash := md5.Sum([]byte(path))
+ return hex.EncodeToString(hash[:])
+}
+
+func IsMimeTypeSupported(mimetype string) bool {
+ return strings.HasPrefix(mimetype, "video") &&
+ strings.HasPrefix(mimetype, "image")
+}