ajout app
This commit is contained in:
15
Voltaserve/api/infra/mime.go
Normal file
15
Voltaserve/api/infra/mime.go
Normal file
@ -0,0 +1,15 @@
|
||||
package infra
|
||||
|
||||
import "github.com/gabriel-vasile/mimetype"
|
||||
|
||||
func DetectMimeFromFile(path string) string {
|
||||
mime, err := mimetype.DetectFile(path)
|
||||
if err != nil {
|
||||
return "application/octet-stream"
|
||||
}
|
||||
return mime.String()
|
||||
}
|
||||
|
||||
func DetectMimeFromBytes(b []byte) string {
|
||||
return mimetype.Detect(b).String()
|
||||
}
|
Reference in New Issue
Block a user