Skip to content

Commit f700aeb

Browse files
cfergeaupraveenkumar
authored andcommitted
download: Don't show progress bar for small files
For files which will be downloaded relatively quickly, the progress bar is going to be a distraction rather than something really useful. This commit introduces a 100MB threshold in file size before showing the progress bar.
1 parent 8178a1b commit f700aeb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pkg/download/download.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ import (
1616
)
1717

1818
func doRequest(client *grab.Client, req *grab.Request) (string, error) {
19+
const minSizeForProgressBar = 100_000_000
20+
1921
resp := client.Do(req)
22+
if resp.Size() < minSizeForProgressBar {
23+
<-resp.Done
24+
return resp.Filename, resp.Err()
25+
}
2026

2127
t := time.NewTicker(500 * time.Millisecond)
2228
defer t.Stop()

0 commit comments

Comments
 (0)