filetype

package
v0.0.0-...-a7c217f Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const DefaultType = "application/octet-stream"

DefaultType is the type used when we can't know/guess the filetype.

Variables

This section is empty.

Functions

func ByExtension

func ByExtension(ext string) string

ByExtension calls mime.TypeByExtension, and removes optional parameters, to keep only the type and subtype. Example: text/html

func FromReader

func FromReader(r io.Reader) (string, io.Reader)

FromReader takes a reader, sniffs the beginning of it, and returns the mime-type (no charset) and a new reader that's the concatenation of the bytes sniffed and the remaining reader.

func Match

func Match(buf []byte) string

Match returns the mime-type (no charset) if it can guess from the first bytes, or the default content-type else.

Types

This section is empty.

Jump to

Keyboard shortcuts

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