mimeutil

package
v0.62.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

Variables

View Source
var ErrUnknownMediaType = errors.New("unknown media type")

Functions

func IsType added in v0.42.1

func IsType(s, mediaType string) bool

IsType checks to see if a media type corresponds to a type/subtype

func MustTypeByFile added in v0.37.6

func MustTypeByFile(name string, useDefault bool) string

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

func MustTypeByFilename(nameOrExt string, useDefault bool) string

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

func TypeByFile(name string) (string, error)

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

func TypeByFilename(nameOrExt string) (string, error)

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.

Jump to

Keyboard shortcuts

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