mimeutil

package
v0.41.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

Variables

This section is empty.

Functions

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