diff options
author | Arne Juul <arnej@yahooinc.com> | 2022-09-29 11:13:10 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2022-09-29 11:13:10 +0000 |
commit | c54b9a640af6349d13226aef8da8c719df333b87 (patch) | |
tree | 2946ad612aee3898e7c21e59481cc74d2649c4fe /client | |
parent | 4f408f71907bd30ff69e2474dcfce715195d87f0 (diff) |
add convenience function
Diffstat (limited to 'client')
-rw-r--r-- | client/go/util/io.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/client/go/util/io.go b/client/go/util/io.go index 68e855b0c3e..fc81bb38f6f 100644 --- a/client/go/util/io.go +++ b/client/go/util/io.go @@ -26,6 +26,12 @@ func IsDirectory(path string) bool { return !errors.Is(err, os.ErrNotExist) && info.IsDir() } +// Returns true is the given path points to an existing file +func IsRegularFile(path string) bool { + info, err := os.Stat(path) + return !errors.Is(err, os.ErrNotExist) && info.Mode().IsRegular() +} + // Returns the content of a reader as a string func ReaderToString(reader io.Reader) string { var buffer strings.Builder |