diff --git a/pkg/downloader/protocol/http/fetcher.go b/pkg/downloader/protocol/http/fetcher.go index d9ed596..d3db8d7 100644 --- a/pkg/downloader/protocol/http/fetcher.go +++ b/pkg/downloader/protocol/http/fetcher.go @@ -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++ { diff --git a/tool/helper.go b/tool/helper.go index 2b5935d..2015e6a 100644 --- a/tool/helper.go +++ b/tool/helper.go @@ -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]) } }