sniff

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AudioExtension

func AudioExtension(header []byte) (string, bool)

AudioExtension sniffs the known audio types, and returns the file extension. header is recommended to at least 16 bytes.

func AudioExtensionWithFallback

func AudioExtensionWithFallback(header []byte, fallback string) string

AudioExtensionWithFallback is equivalent to AudioExtension, but returns fallback most likely to use .mp3 as fallback, because mp3 files may not have ID3v2 tag.

func ImageExtension

func ImageExtension(header []byte) (string, bool)

ImageExtension is equivalent to ImageMIME, but returns file extension

func ImageMIME

func ImageMIME(header []byte) (string, bool)

ImageMIME sniffs the well-known image types, and returns its MIME.

Types

type Sniffer

type Sniffer interface {
	Sniff(header []byte) bool
}

Jump to

Keyboard shortcuts

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