Go mime: MIME types and file extensions
Answer: Package mime implements parts of the MIME spec. TypeByExtension returns the MIME type for a file extension, and the extension should begin with a leading dot, as in ".html". AddExtensionType sets the MIME type for an extension.
Examples
mime.TypeByExtension(".html")
Notes
WordDecoder decodes RFC 2047 encoded-words.
Reference list
mimeimplements parts of the MIME spec.TypeByExtensionreturns the MIME type for a file extension.AddExtensionTypesets the MIME type for an extension.
See also
Claims
- id: C1 claim: Package mime implements parts of the MIME spec. source: S1 evidence: "Package mime implements parts of the MIME spec."
- id: C2 claim: TypeByExtension returns the MIME type for a file extension. source: S2 evidence: "TypeByExtension returns the MIME type associated with the file extension ext."
- id: C3 claim: The extension should begin with a leading dot. source: S2 evidence: "The extension ext should begin with a leading dot, as in \".html\"."
Sources
- [S1] mime package. Go docs. https://pkg.go.dev/mime . License: BSD-3-Clause. Accessed 2026-11-18.
- [S2] mime type.go. Go source. https://raw.githubusercontent.com/golang/go/master/src/mime/type.go . License: BSD-3-Clause. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go docs, mime package; Go source, mime type.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go docs, mime package; Go source, mime type.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go mime: MIME types and file extensions." iinventedlight Library, iil:note:3at26ea3, version of 2026-11-18. https://iinventedlight.com/library/notes/go-mime/. License: CC-BY-4.0.
@misc{iil_note_3at26ea3,
author = {{iinventedlight}},
title = {{Go mime: MIME types and file extensions}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/go-mime/},
note = {Permanent ID iil:note:3at26ea3. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-mime.table.json (table; CC-BY-4.0)
- go-mime.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-mime.md.