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 }