GitHub - g-tool/du: DU:Simple golang package and CLI tool to download&upload large files

Simple and fast concurrent downloader & uploader.

InstallationCLI UsageModule UsageLicense

Comparison

Comparison in cloud server:

Installation

Download and install the latest release:

# go to tmp dir.
cd /tmp

# Download latest version.
curl -sfL https://git.io/getdu | sh

# Make the binary executable.
chmod +x /tmp/bin/du

# Move the binary to your PATH
sudo mv /tmp/bin/du /usr/bin/du

Or Go ahead compile it yourself:

go get github.com/g-tool/du/cmd/du

Note: these packages are not maintained by g-tool

Command Line Tool Usage

Simple usage:

du https://example.com/file.mp4

You can specify destination path:

du -o /path/to/save https://example.com/file.mp4

You can download multiple URLs and save them to directory:

du --dir /path/to/dir https://example.com/file.mp4 https://example.com/file2.mp4

You can download multiple URLs from a file:

du --dir /path/to/dir -f urls.txt

You can pipe multiple URLs:

cat urls.txt | du --dir /path/to/dir

Docs for available flags:

Module Usage

You can use DU to download large files in your go code, the usage is simple as the CLI tool:

package main

import "github.com/go-tool/du"

func main() {

	d := du.New()

	err := d.Download("http://localhost/file.ext", "/path/to/save")

	if err != nil {
		// ..
	}
}

For more see PkgDocs.

How It Works?

DU takes advantage of the HTTP range requests support in servers RFC 7233, if the server supports partial content DU split the file into chunks, then starts downloading and merging the chunks into the destinaton file concurrently.

License

DU is provided under the MIT License © Tacey Wong.