Created
Some checks failed
Go / build (push) Failing after 7s

This commit is contained in:
scheibling
2025-04-08 19:16:39 +02:00
commit b4eb50ab55
63 changed files with 7333 additions and 0 deletions

40
filex/file.go Normal file
View File

@@ -0,0 +1,40 @@
package filex
import (
"os"
)
// IsFile Check path is a file
func IsFile(path string) bool {
fi, err := os.Stat(path)
if err != nil {
return false
}
return !fi.IsDir()
}
// IsDir Check path is directory
func IsDir(path string) bool {
fi, err := os.Stat(path)
if err != nil {
return false
}
return fi.IsDir()
}
// Exists Check path is exists
func Exists(path string) bool {
_, err := os.Stat(path)
if err == nil || os.IsExist(err) {
return true
}
return false
}
// Size Return file size
func Size(path string) int64 {
if fi, err := os.Stat(path); err == nil {
return fi.Size()
}
return 0
}