Simple Go package for file chunk async download that made just for fun. Choose a file, slice it up, download it. Please do not set 20 chunks for a 10kb file.
Fetch package
go get github.com/AlexyAV/splitter
import (
splitter "github.com/AlexyAV/splitter"
)
func main() {
// With absolute destination path
pr := splitter.NewPathResolver(
"https://via.placeholder.com/3000",
"/tmp/",
&http.Client{},
)
pi, err := pr.PathInfo()
if err != nil {
log.Fatal(err)
}
// Create Splitter instance with new PathInfo and 10 chunks
s := splitter.NewSplitter(context.Background(), pi, 10, &http.Client{})
// Start file download
err = s.Download()
if err != nil {
log.Fatal(err)
}
}