1
0
Fork 0
mirror of https://git.sr.ht/~rjarry/aerc synced 2025-02-22 23:23:57 +01:00
aerc/worker/lib/size.go
Robin Jarry 57088312fd worker: move shared code to lib
Avoid importing code from worker/lib into lib. It should only be the
other way around. Move the message parsing code used by maildir,
notmuch, mbox and the eml viewer into a lib/rfc822 package.

Adapt imports accordingly.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Tested-by: Inwit <inwit@sindominio.net>
2023-10-28 19:24:55 +02:00

15 lines
294 B
Go

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
}