mime

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Types is a whitelist of all supported
	// mime types. Taken from https://developer.mozilla.org/
	Types = map[string]string{
		"application/pdf":             "pdf",
		"application/json":            "json",
		"application/gzip":            "gz",
		"application/vnd.rar":         "rar",
		"application/zip":             "zip",
		"application/x-7z-compressed": "7z",
		"image/png":                   "png",
		"image/jpeg":                  "jpg",
		"image/gif":                   "gif",
		"image/svg+xml":               "svg",
		"text/csv":                    "csv",
		"text/plain":                  "txt",
		"audio/mpeg":                  "mp3",
		"audio/ogg":                   "ogg",
		"audio/opus":                  "opus",
		"audio/webm":                  "weba",
		"video/mp4":                   "mp4",
		"video/mpeg":                  "mpeg",
		"video/webm":                  "webm",
	}
)

Functions

func GetExtension

func GetExtension(t string) string

GetExtension returns an extension for the given MIME type

func IsValid

func IsValid(t string) bool

IsValid checks if given type is inside Types map

Types

This section is empty.

Jump to

Keyboard shortcuts

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