aboutsummaryrefslogtreecommitdiffstats
path: root/worker/lib/size.go
blob: f00437c39abf93cb57f92d52121096c4724b5636 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package lib

import (
	"fmt"
	"os"
)

// 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
}