From 0ce7678c21f0413e33ead8e1ad985a12fa5e61d2 Mon Sep 17 00:00:00 2001 From: bvbej Date: Fri, 9 Aug 2024 15:31:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9F=9A=80]=2064KB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/downloader/protocol/http/fetcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++ { From e65d101476f30f469369e51a4ad58317c983c85e Mon Sep 17 00:00:00 2001 From: bvbej Date: Fri, 9 Aug 2024 15:34:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=F0=9F=9A=80]=2064KB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/helper.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]) } }