diff options
author | Emiliano Ciavatta | 2020-04-21 17:26:23 +0000 |
---|---|---|
committer | Emiliano Ciavatta | 2020-04-21 17:26:23 +0000 |
commit | f8dd01e9cd59ff7c0920eab3dd65c02a15de059e (patch) | |
tree | b10f881d6a9f889911c7661e44ff55881b361665 /utils.go | |
parent | 26c992c0b529ad52910ee9ed8f8b13dc9f3b9904 (diff) |
Add application_router tests; change connection_stream key hash method
Diffstat (limited to 'utils.go')
-rw-r--r-- | utils.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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() +} |