Documentation ¶
Index ¶
- Constants
- Variables
- func IsType(mediaType, s string) bool
- func MustTypeByFile(name string, useDefault bool) string
- func MustTypeByFilename(nameOrExt string, useDefault bool) string
- func TypeByFile(name string) (string, error)
- func TypeByFilename(nameOrExt string) (string, error)
- func TypeByReadSeeker(rs io.ReadSeeker, resetPointer bool) (string, error)
Constants ¶
const DefaultMIMEType = httputilmore.ContentTypeAppOctetStream
Variables ¶
var ErrUnknownMediaType = errors.New("unknown media type")
Functions ¶
func MustTypeByFile ¶ added in v0.37.6
MustTypeByFile follows the convention of `mime.TypeByExtension` by returning an empty string if type not found. If `useDefault` is set, a non-detected value is set to `application/octet-stream` which is the default for `http.DetectContentType`.
func MustTypeByFilename ¶ added in v0.37.6
MustTypeByFilename follows the convention of `mime.TypeByExtension` by returning an empty string if type not found. If `useDefault` is set, a non-detected value is set to `application/octet-stream` which is the default for `http.DetectContentType`.
func TypeByFile ¶ added in v0.37.6
TypeByFile detects the media type by reading MIME type information of the file content. It relies on `http.DetectContentType“
func TypeByFilename ¶ added in v0.37.6
TypeByFilename detects a mimetype using `mime.TypeByExtension`.
func TypeByReadSeeker ¶ added in v0.37.6
func TypeByReadSeeker(rs io.ReadSeeker, resetPointer bool) (string, error)
TypeByReadSeeker detects the media type by reading MIME type information of an `io.ReadSeeker`. It relies on `http.DetectContentType`
Types ¶
This section is empty.