typesniffer

package
v1.15.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const SvgMimeType = "image/svg+xml"

SvgMimeType MIME type of SVG images.

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) IsAudio

func (ct SniffedType) IsAudio() bool

IsAudio detects if data is an video format

func (SniffedType) IsImage

func (ct SniffedType) IsImage() bool

IsImage detects if data is an image format

func (SniffedType) IsPDF

func (ct SniffedType) IsPDF() bool

IsPDF detects if data is a PDF 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL