study_xxqg/utils/file.go

25 lines
340 B
Go
Raw Normal View History

2022-04-25 10:39:54 +00:00
package utils
import (
"crypto/md5"
"encoding/hex"
"os"
)
func FileIsExist(path string) bool {
_, err := os.Stat(path)
if err == nil {
return true
}
if os.IsNotExist(err) {
return false
}
return false
}
func StrMd5(str string) (retMd5 string) {
h := md5.New()
h.Write([]byte(str))
return hex.EncodeToString(h.Sum(nil))
}