Description
hget allows you to download files at maximum speed using workers (goroutines), and shines when the bottleneck is on the server, rather than the client.
It takes advantage of the Range
header, allowing many workers to download in parallel a file. That said, it is not a Swiss Army Knife: if there is no bottleneck in the server, it is probably better to use just 1 download worker; else, you should set the number of workers to the minimum value that allows you to download at the maximum of your internet speed.
For example, if the client can download 100MB/s and the server only provides you 10MB/s per worker, then it would be wise to use ~10 download workers. Nevertheless, if the client has 10MB/s and the server provides you >10MB/s, there is no need to use more than 1.
Other features of this software are,
- Interruptible downloads: press Ctrl + C or ⌘ + C and the download will stop gracefully.
- Resumable downloads: use
hget resume ID
to resume an interrupted download.
- Prevent file collision: enable the collision protection in the configuration and downloads with the same name will not collide (a random string is included before the filename).
(back to top)
Usage
Download
hget [-n workers] URL
-n
Download workers (Default: CPUs).
List
hget list
Resume
hget resume ID
Remove
hget remove ID
Clear
hget clear
(back to top)
Configuration
The configuration file is located by default at $HOME/.hget/config.toml
.
# Folder used by the program to save temporal files, such as ongoing and paused downloads.
program_folder = "$HOME/.hget" # This will not work. Write an absolute path instead.
# Restricts the logs to what the user wants to get. 0 means no logs, 1 only important logs and 2 all logs.
log_level = 2
# Defines the directory in which the downloaded file will be moved.
download.folder = "$PWD" # This will not work. Write an absolute path instead.
# Sets the bytes to copy in a row from the response body.
download.copy_n_bytes = 300
# Enables/disables the collision protection using a random string when saving the file to the final destination.
download.collision_protection = false
(back to top)
Acknowledgments
- huydx for creating the initial version of this project.
(back to top)
License
Distributed under the MIT License. See LICENSE.txt
for more information.
(back to top)