aboutsummaryrefslogtreecommitdiff
path: root/utils.go
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-04-21 17:26:23 +0000
committerEmiliano Ciavatta2020-04-21 17:26:23 +0000
commitf8dd01e9cd59ff7c0920eab3dd65c02a15de059e (patch)
treeb10f881d6a9f889911c7661e44ff55881b361665 /utils.go
parent26c992c0b529ad52910ee9ed8f8b13dc9f3b9904 (diff)
Add application_router tests; change connection_stream key hash method
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/utils.go b/utils.go
index b9cdd8c..de83ecb 100644
--- a/utils.go
+++ b/utils.go
@@ -57,3 +57,19 @@ func RowIDFromHex(hex string) (RowID, error) {
rowID, err := primitive.ObjectIDFromHex(hex)
return rowID, err
}
+
+func FileExists(filename string) bool {
+ info, err := os.Stat(filename)
+ if os.IsNotExist(err) {
+ return false
+ }
+ return !info.IsDir()
+}
+
+func FileSize(filename string) int64 {
+ info, err := os.Stat(filename)
+ if os.IsNotExist(err) {
+ return -1
+ }
+ return info.Size()
+}