From 7a27845e75e1cb2cd13adaab3e2fc515a9236f33 Mon Sep 17 00:00:00 2001 From: lb-a Date: Wed, 29 Apr 2026 23:56:05 +0200 Subject: [PATCH] performance: change I/O buffer size --- internal/download/downloader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/download/downloader.go b/internal/download/downloader.go index d04f7bc..e9a3b44 100644 --- a/internal/download/downloader.go +++ b/internal/download/downloader.go @@ -246,7 +246,7 @@ func (d *Downloader) file(ctx context.Context, sourceURL, outputPath string, all ) defer bar.SetTotal(-1, true) } - buf := make([]byte, 256*1024) + buf := make([]byte, downloadBufferSize) totalWritten := int64(0) for { n, readErr := reader.Read(buf) @@ -271,7 +271,7 @@ func (d *Downloader) file(ctx context.Context, sourceURL, outputPath string, all return err } } else { - written, copyErr := io.Copy(out, reader) + written, copyErr := io.CopyBuffer(out, reader, make([]byte, downloadBufferSize)) if copyErr != nil { return copyErr }