aboutsummaryrefslogtreecommitdiffstats
path: root/worker/lib
diff options
context:
space:
mode:
Diffstat (limited to 'worker/lib')
-rw-r--r--worker/lib/parse.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/worker/lib/parse.go b/worker/lib/parse.go
index 3baaa459..ac86292f 100644
--- a/worker/lib/parse.go
+++ b/worker/lib/parse.go
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
+ "os"
"regexp"
"strings"
"time"
@@ -381,3 +382,12 @@ func ReadMessage(r io.Reader) (*message.Entity, error) {
}
return entity, nil
}
+
+// FileSize returns the size of the file specified by name
+func FileSize(name string) (uint32, error) {
+ fileInfo, err := os.Stat(name)
+ if err != nil {
+ return 0, fmt.Errorf("failed to obtain fileinfo: %w", err)
+ }
+ return uint32(fileInfo.Size()), nil
+}