Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

sniff

v0.0.0-20180504072447-bdcd46c54acf
github.com/badu/http/sniff

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

4 matches

Top ↑

Constants

Len

const Len = 512

The algorithm uses at most sniffLen bytes to make its decision.

Functions

DetectContentType

func DetectContentType(data []byte) string

DetectContentType implements the algorithm described at http://mimesniff.spec.whatwg.org/ to determine the Content-Type of the given data. It considers at most the first 512 bytes of data. DetectContentType always returns a valid MIME type: if it cannot determine a more specific one, it returns "application/octet-stream".

Dependency graph