feat: 增加文件压缩功能
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user