Documentation
¶
Index ¶
- Variables
- func DetectExtension(buf []byte) string
- func DetectMime(stream io.Reader) (*mimetype.MIME, error)
- func DetectType(buf []byte) string
- func IsAllowedContentType(contentType string, allowedContentType []string) bool
- func ResizeImage(file io.Reader, contentType string, width, height uint) ([]byte, error)
- func SetMimeReadLimit(n uint32)
- type MediaType
- type MediaTypeInfo
- type Reader
Constants ¶
This section is empty.
Variables ¶
View Source
var MediaType_Value = map[string]int32{
"MEDIA_TYPE_UNSPECIFIED": 0,
"MEDIA_TYPE_UNKNOWN": 1,
"TEXT": 4,
"IMAGE": 5,
"AUDIO": 6,
"VIDEO": 7,
"FILE": 8,
}
View Source
var MediaType_name = map[int32]string{
0: "MEDIA_TYPE_UNSPECIFIED",
1: "MEDIA_TYPE_UNKNOWN",
4: "TEXT",
5: "IMAGE",
6: "AUDIO",
7: "VIDEO",
8: "FILE",
}
Functions ¶
func DetectExtension ¶
func DetectType ¶
func IsAllowedContentType ¶
func ResizeImage ¶
func SetMimeReadLimit ¶
func SetMimeReadLimit(n uint32)
Types ¶
type MediaType ¶
type MediaType int32
const ( // The Default value MediaType_MEDIA_TYPE_UNSPECIFIED MediaType = 0 // MediaType_MEDIA_TYPE_UNKNOWN Type is unknown. This is usually used when a process was unable to determine the type. MediaType_MEDIA_TYPE_UNKNOWN MediaType = 1 MediaType_TEXT MediaType = 4 MediaType_IMAGE MediaType = 5 MediaType_AUDIO MediaType = 6 MediaType_VIDEO MediaType = 7 MediaType_FILE MediaType = 8 )
type MediaTypeInfo ¶
type MediaTypeInfo interface { // MediaType returns the type of media for this info MediaType() MediaType // DirectoryName return a string which usually used to construct path for storing the media files DirectoryName() string // IsContentTypeAllowed returns true if the provided content type string is allowed for the media type IsContentTypeAllowed(contentType string) bool // MimeType returns mimetype.MIME wich is mimetype info of the document, // accept Reader as input, read whole file instead of partial byte of the Reader DetectReader(r io.Reader) (*mimetype.MIME, error) }
func GetMediaTypeInfo ¶
func GetMediaTypeInfo(mediaType MediaType) MediaTypeInfo
func GetMediaTypeInfoByTypeName ¶
func GetMediaTypeInfoByTypeName(mediaTypeName string) MediaTypeInfo
Click to show internal directories.
Click to hide internal directories.