Documentation ¶
Index ¶
- Constants
- type SniffedType
- func (ct SniffedType) GetMimeType() string
- func (ct SniffedType) IsAudio() bool
- func (ct SniffedType) IsBrowsableBinaryType() bool
- func (ct SniffedType) IsImage() bool
- func (ct SniffedType) IsPDF() bool
- func (ct SniffedType) IsRepresentableAsText() bool
- func (ct SniffedType) IsSvgImage() bool
- func (ct SniffedType) IsText() bool
- func (ct SniffedType) IsVideo() bool
Constants ¶
const ( // SvgMimeType MIME type of SVG images. SvgMimeType = "image/svg+xml" // ApplicationOctetStream MIME type of binary files. ApplicationOctetStream = "application/octet-stream" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SniffedType ¶
type SniffedType struct {
// contains filtered or unexported fields
}
SniffedType contains information about a blobs type.
func DetectContentType ¶
func DetectContentType(data []byte) SniffedType
DetectContentType extends http.DetectContentType with more content types. Defaults to text/unknown if input is empty.
func DetectContentTypeFromReader ¶
func DetectContentTypeFromReader(r io.Reader) (SniffedType, error)
DetectContentTypeFromReader guesses the content type contained in the reader.
func (SniffedType) GetMimeType ¶
func (ct SniffedType) GetMimeType() string
GetMimeType returns the mime type
func (SniffedType) IsAudio ¶
func (ct SniffedType) IsAudio() bool
IsAudio detects if data is an video format
func (SniffedType) IsBrowsableBinaryType ¶
func (ct SniffedType) IsBrowsableBinaryType() bool
IsBrowsableType returns whether a non-text type can be displayed in a browser
func (SniffedType) IsImage ¶
func (ct SniffedType) IsImage() bool
IsImage detects if data is an image format
func (SniffedType) IsRepresentableAsText ¶
func (ct SniffedType) IsRepresentableAsText() bool
IsRepresentableAsText returns true if file content can be represented as plain text or is empty.
func (SniffedType) IsSvgImage ¶
func (ct SniffedType) IsSvgImage() bool
IsSvgImage detects if data is an SVG image format
func (SniffedType) IsText ¶
func (ct SniffedType) IsText() bool
IsText etects if content format is plain text.
func (SniffedType) IsVideo ¶
func (ct SniffedType) IsVideo() bool
IsVideo detects if data is an video format