mirror of
https://github.com/h2non/filetype.git
synced 2025-12-24 11:52:08 +08:00
19 lines
276 B
Go
19 lines
276 B
Go
package types
|
|
|
|
var Types = make(map[string]Type)
|
|
|
|
// Register a new type
|
|
func Add(t Type) Type {
|
|
Types[t.Extension] = t
|
|
return t
|
|
}
|
|
|
|
// Retrieve a Type by extension
|
|
func Get(ext string) Type {
|
|
kind := Types[ext]
|
|
if kind.Extension != "" {
|
|
return kind
|
|
}
|
|
return Unknown
|
|
}
|