Conversation
Adding context and support for multi file downloads. change: `New` func now returns new *Got instead of *Download add: `NewWithContext` func. add: `NewDownload` returns new *Download change: Progress methods now is a part of the download add: Context add: `RunProgress` method to run ProgressFunc rm: `Progress` removed
|
I have implemented a little bit different approach, simpler to multiple downloads, API: dl, err := got.New(context.Background(), got.Config { })
// Check error
err = dl.Download(url, savePath)
// Check error
// Multiple downloads can be done like this
go func() { dl.Download(...) }
// Many times ...This requires a little bit more change for the pull request #16 (Combine methods Start() and others into Downalod). |
|
In this draft every file have an independent
I guess I have to remove |
|
Yeah, Could you make a full example for your version of the API, so we can check how it works and make more proposals |
|
You can check examples in: |
What about Example: d := got.New(got.Config{ })
d := got.NewWithContext(ctx, got.Config{}) |
|
we can use |
Yeah, that would be great, |
|
yes |
|
I will remove errgroup from |
|
New API looks really simple, now I see, there is no need for PS. I and my friend are making PKGBUILD for AUR |
|
cool π |
When 0.2 will be released? |
|
probably tonight |
This is simply not true, as soon as the first error occurs, the context is canceled and all context-aware goroutines get a chance to stop.
|
|
@suzaku is errgroup faster than the channel approach? I think channels faster? |
|
@suzaku waiting for your feedback before merge. |
It doesn't really matter here. When thinking about performance, we need to pinpoint the bottleneck. I don't think the bottleneck of downloading is the |
|
This is unnecessary usage of resources, when network error happens or any other error, download should be stop (maybe layer down the line we can implement some kind of recovery mechanism). |
|
Merged thank you for your help β€οΈ |
Adding support for multiple file downloads and
ContextRelated PRs: #15 and #16
The New API:
Multiple file download
Multiple files with context:
Download Single file:
CLI
Single file:
Multiple files:
Multiple save to specific dir:
From stdin:
cat file.txt | got --dir /dirFrom file:
Waiting for your feedback:
@suzaku @malusev998 @poldi1405 @xurwxj