1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package main import ( "mime" "os" "path/filepath" ) func absPathMime(path string) string { ext := filepath.Ext(path) return mime.TypeByExtension(ext) } func isFile(path string) bool { fileInfo, err := os.Stat(path) if err != nil { return false } return fileInfo.Mode().IsRegular() }