Merge pull request 'dev' (#6) from dev into main

Reviewed-on: #6
This commit is contained in:
bvbej 2024-08-09 15:35:20 +08:00
commit 4d7668c9ff
2 changed files with 3 additions and 2 deletions

View File

@ -260,7 +260,7 @@ func (f *Fetcher) fetchChunk(index int) (err error) {
return err
}
var buf = make([]byte, 8192)
var buf = make([]byte, 64*1024) // 64KB
// 重试10次
for i := 0; i < 10; i++ {

View File

@ -5,6 +5,7 @@ import (
"bytes"
"errors"
"fmt"
"github.com/spf13/cast"
"io"
"math"
"math/rand"
@ -43,7 +44,7 @@ func ByteFmt(size int64) string {
if frac > 0 {
return fmt.Sprintf("%.1f%s", math.Floor(val*10)/10, unitArr[p])
} else {
return fmt.Sprintf("%d%s", int(val), unitArr[p])
return fmt.Sprintf("%d%s", cast.ToInt(val), unitArr[p])
}
}