Skip to content
Download a file with multiple connections and multiple sources simultaneously.
Go Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd
test
.gitignore
.travis.yml
LICENSE
Makefile
README.md
downloader.go
downloader_test.go
verbose.go

README.md

Multi-part file downloader

Download a file with multiple connections and multiple sources simultaneously.

Build Status Doc Status

Installation

# Build the executable
make

# Install as library
go get github.com/alvatar/multipart-downloader

Usage

godl [flags ...] [urls ...]

Flags:
    -n      Number of concurrent connections
    -S      A SHA-256 string to check the downloaded file
    -E      Verify using Etag as MD5
    -t      Timeout for all connections in milliseconds (default 5000)
    -o      Output file
    -v      Verbose output, show progress bars

Usage as library

urls := []string{
    "https://raw.githubusercontent.com/alvatar/multipart-downloader/master/test/quijote.txt",
    "https://raw.githubusercontent.com/alvatar/multipart-downloader/master/test/quijote2.txt",}
nConns := 2
timeout := time.Duration(5000) * time.Millisecond
dldr := md.NewMultiDownloader(urls, nConns, timeout)

// Gather info from all sources
_, err := dldr.GatherInfo()

// Prepare the file to write downloaded blocks on it
_, err = dldr.SetupFile(*output)

// Perform download
err = dldr.Download(func(feedback []md.ConnectionProgress) {
		log.Println(feedback)
	})

err = dldr.CheckSHA256("1e9bb1b16f8810e44d6d5ede7005258518fa976719bc2ed254308e73c357cfcc")
err = dldr.CheckMD5("45bb5fc96bb4c67778d288fba98eee48")
You can’t perform that action at this time.