diff options
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 |