MCPcopy Index your code
hub / github.com/coder/coder / DetectMediaType

Function DetectMediaType

coderd/x/chatfiles/mime.go:52–54  ·  view source on GitHub ↗

DetectMediaType detects the base media type of the given file contents.

(data []byte)

Source from the content-addressed store, hash-verified

50
51// DetectMediaType detects the base media type of the given file contents.
52func DetectMediaType(data []byte) string {
53 return BaseMediaType(mimetype.Detect(data).String())
54}
55
56// BaseMediaType strips parameters from a media type.
57func BaseMediaType(mediaType string) string {

Callers 3

TestDetectMediaType_WebPFunction · 0.92
PrepareRecordingArtifactFunction · 0.85
ClassifyStoredMediaTypeFunction · 0.85

Calls 2

BaseMediaTypeFunction · 0.85
StringMethod · 0.45

Tested by 1

TestDetectMediaType_WebPFunction · 0.74