mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
performance: change I/O buffer size
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user