mimeutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtensionByType

func ExtensionByType(typ string) string

Preferred file extension with its leading dot for a media type, matched without regard to case, parameters or surrounding space: the built-in table's for every type it holds, else the alphabetically first the host knows through the standard mime package, "" when neither knows the type

func IsText

func IsText(typ string) bool

Whether a media type, parameters ignored, carries text: any text type, any +json, +xml or +yaml type, the textual application types (JSON, XML, YAML, TOML, JavaScript, SQL, shell, PHP, TeX, troff, Tcl, RDF, HLS playlist, MIF, WAIS source) and mail messages

func TypeByExtension

func TypeByExtension(ext string) string

Media type of a file extension given with its leading dot, matched without regard to case: the built-in table's type for every extension it holds, else the host's through the standard mime package (the shared MIME database or mime.types files on Unix, the registry on Windows) with parameters such as charset cut, "" when neither knows it

func TypeByName

func TypeByName(name string) string

Media type of a file name or path from the extension of its last element as TypeByExtension types it, "" when it has no known one; a leading dot starts no extension, so .png is a name, and a compressed file is typed by its compression (x.tar.gz is application/gzip)

func TypeByURL

func TypeByURL(ref string) string

Media type of a URL, the declared type of a data URL (text/plain when it declares none or an invalid one, "" without its comma), else the type of the URL path's last segment with any query, fragment and ;parameters cut; text with no scheme of two or more characters is a file name or path as TypeByName reads it

Types

This section is empty.

Jump to

Keyboard shortcuts

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