feat: 增加文件压缩功能

This commit is contained in:
zhengkunwang223
2022-08-30 17:59:59 +08:00
parent 12527de2ba
commit 20129c7d0b
20 changed files with 442 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
package files
import (
"github.com/gabriel-vasile/mimetype"
"os"
"os/user"
"strconv"
@@ -25,3 +26,11 @@ func GetGroup(gid uint32) string {
}
return usr.Name
}
func GetMimeType(path string) string {
mime, err := mimetype.DetectFile(path)
if err != nil {
return ""
}
return mime.String()
}