53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package constants
|
|
|
|
type FileType string
|
|
|
|
const (
|
|
FileTypeUnknown FileType = "unknown"
|
|
FileTypeImage FileType = "image"
|
|
//FileTypeVideo FileType = "video"
|
|
FileTypeExcel FileType = "excel"
|
|
FileTypeWord FileType = "word"
|
|
FileTypeTxt FileType = "txt"
|
|
FileTypePDF FileType = "pdf"
|
|
FileTypePPT FileType = "ppt"
|
|
FileTypeCSV FileType = "csv"
|
|
)
|
|
|
|
var FileTypeMappings = map[FileType][]string{
|
|
FileTypeImage: {
|
|
"image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml",
|
|
".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg",
|
|
},
|
|
FileTypeExcel: {
|
|
"application/vnd.ms-excel",
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
".xls", ".xlsx",
|
|
},
|
|
FileTypeWord: {
|
|
"application/msword",
|
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
".doc", ".docx",
|
|
},
|
|
FileTypePDF: {
|
|
"application/pdf",
|
|
".pdf",
|
|
},
|
|
FileTypeTxt: {
|
|
"text/plain",
|
|
".txt",
|
|
},
|
|
FileTypePPT: {
|
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
".pptx",
|
|
},
|
|
FileTypeCSV: {
|
|
"text/csv",
|
|
".csv",
|
|
},
|
|
}
|
|
|
|
func (ft FileType) String() string {
|
|
return string(ft)
|
|
}
|