start work on media storage
This commit is contained in:
parent
cb67b6e2fb
commit
3964c32438
5 changed files with 64 additions and 1 deletions
36
storage/mediaProvider/preprocessor.go
Normal file
36
storage/mediaProvider/preprocessor.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package mediaprovider
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
)
|
||||
|
||||
func Compress(dataReader io.Reader, mimeType *string) (io.Reader, error) {
|
||||
data, err := io.ReadAll(dataReader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if mimeType == nil {
|
||||
*mimeType = mimetype.Detect(data).String()
|
||||
}
|
||||
uberType, subType, _ := strings.Cut(*mimeType, "/")
|
||||
var dataOut []byte
|
||||
switch uberType {
|
||||
case "text":
|
||||
case "application":
|
||||
case "image":
|
||||
case "video":
|
||||
dataOut, err = compressVideo(data, subType)
|
||||
case "audio":
|
||||
case "font":
|
||||
default:
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func compressVideo(dataIn []byte, subType string) (dataOut []byte, err error) {
|
||||
// TODO: Implement me
|
||||
panic("Implement me")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue