aboutsummaryrefslogtreecommitdiff
path: root/fileutils.go
blob: 557d21cba861bcfd28347d9469cc9b2601df8ad5 (plain) (blame)
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()
}