diff options
Diffstat (limited to 'filesystem.go')
-rw-r--r-- | filesystem.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/filesystem.go b/filesystem.go index dec07f3..f744714 100644 --- a/filesystem.go +++ b/filesystem.go @@ -32,6 +32,17 @@ func HumanReadableSize(size int64) string { return ret } +func IsExist(path string) (bool, error) { + _, err := os.Stat(path) + if os.IsNotExist(err) { + return false, nil + } + if err != nil { + return false, err + } + return true, nil +} + func IsFile(path string) (bool, error) { info, err := os.Stat(path) if err != nil { |