added preload transfer rate

This commit is contained in:
ston1th 2022-10-08 20:35:05 +02:00
commit 470eeb921c
5 changed files with 111 additions and 13 deletions

View file

@ -126,12 +126,7 @@ const (
TiB
)
func (fs *FS) FileSize(name string) (size string) {
fi, err := fs.Stat(name)
if err != nil {
return
}
s := fi.Size()
func FileSize(s int64) string {
switch {
case s >= TiB:
return strconv.Itoa(int(s/TiB)) + " TiB"
@ -145,6 +140,14 @@ func (fs *FS) FileSize(name string) (size string) {
return strconv.Itoa(int(s)) + " B"
}
func (fs *FS) FileSize(name string) string {
fi, err := fs.Stat(name)
if err != nil {
return ""
}
return FileSize(fi.Size())
}
func (fs *FS) RemoveDst(name string) error {
return fs.dst.Remove(name)
}