aget-rs is a fast asynchronous downloader written in Rust.
It requests a resource with a number of concurrent asynchronous request in a single thread.
Especially, the concurrent amount can be any positive number as your wish.
aget-rs supports to download a HTTP/S link, a M3U8 video link, a Torrent and a magnet link.
You can download the last release from https://github.com/PeterDing/aget-rs/releases
We conside that there is a file to download. This file has 10MB. The server which hosts the file has been set a limit rate to 100KB/s, but no connecting count limit.
It will be easy to calculate the total costing time when we use 1, 10, 100 connections to request the file.
In the benchmark test, we use nginx to simulate the environment where a limit rate is 100KB/s for downloading.
Following is the results of using curl and aget-rs. (For more details, you can find at here)
-
One connection using
curltime curl http://localhost:9010/abc % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10.0M 100 10.0M 0 0 100k 0 0:01:42 0:01:42 --:--:-- 103k real 1m42.147s user 0m0.021s sys 0m0.035stime cost: 102s
-
10 connections using
aget-rstime ag http://localhost:9010/abc -s 10 -k 1m File: abc Length: 10.0M (10485760) 10.0M/10.0M 100.00% NaNG/s eta: 0s [==================================>] real 0m10.016s user 0m0.040s sys 0m0.020stime cost: 10s, 10 times faster than curl
-
100 connections using
aget-rstime ag http://localhost:9010/abc -s 100 -k 103k File: abc Length: 10.0M (10485760) 10.0M/10.0M 100.00% NaNG/s eta: 0s [==================================>] real 0m2.016s user 0m0.087s sys 0m0.029stime cost: 2s, 50 times faster than curl
-
Request a resource with default configuration
The default concurrent amount is
10and chunk length is1m.ag http://cdimage.ubuntu.com/ubuntu/releases/18.10/release/ubuntu-18.10-server-amd64.iso
-
Set concurrent amount and chunk length
Use
-sor--concurrencyto set the number of concurrent request.
Use-kor--chunk-sizeto set the chunk length of each request.
--chunk-sizetakes a literal size description, example1kfor one Kilobyte,
2mfor two Megabyte,1gfor Gigabyte.ag "url of resource" -s 20 -k 1m -
Set a path for output
Use
-oor--outto set the path.
If the argument is not gave, we take the last part of the url' path as the path.ag "url of resource" -o /path/to/fileWhen download a torrent or magnet link, the path is the output directory.
-
Set request headers
Use
-Hto set headers.ag "url of resource" -H "Cookie: key=value" -H "Accept: */*"
-
Set request method and data
Use
-Xor--methodto set method for http, example,GET,POST.
The default method isGET.
With a data, using-dor--data, example,a=bag "url of resource" -d "a=b"
-
Download a torrent or magnet link
Warning: The
/path/to/outdirdirectory below command must NOT exist. It will be created automatically.ag "magnet:..." -o /path/to/outdir ag "/path/to/torrent" -o /path/to/outdir ag "http://example.com/some.torrent" -o /path/to/outdir
Use
--bt-file-regexto only download files matching it in the torrent.ag "magnet:..." -o /path/to/outdir --bt-file-regex ".*\.mp4"
Use
--seedto seed the torrent after downloaded.ag "magnet:..." -o /path/to/outdir --seedUse
--bt-trackersto specify trackers with comma as delimiter.ag "magnet:..." -o /path/to/outdir --bt-trackers "udp://tracker.opentrackr.org:1337/announce,udp://opentracker.io:6969/announce"
Usage: ag [OPTIONS] <URL>
Arguments:
<URL>
Options:
-m, --method <METHOD> Request method, e.g. GET, POST [default: GET]
-H, --header <HEADER> Request headers, e.g. -H "User-Agent: aget"
-d, --data <DATA> Request with POST method with the data, e.g. -d "a=b"
--insecure Skip to verify the server's TLS certificate
-s, --concurrency <CONCURRENCY> The number of concurrency request [default: 10]
-k, --chunk-size <CHUNK_SIZE> The number ofinterval length of each concurrent request [default: '50m']
-t, --timeout <TIMEOUT> Timeout(seconds) of request [default: 60]
--dns-timeout <DNS_TIMEOUT> DNS Timeout(seconds) of request [default: 10]
--retries <RETRIES> The maximum times of retring [default: 5]
--retry-wait <RETRY_WAIT> The seconds between retries [default: 0]
--proxy <PROXY> [protocol://]host[:port] Use this proxy
--type <TYPE> Task type, auto/http/m3u8/bt [default: auto]
--bt-file-regex <BT_FILE_REGEX> A regex to only download files matching it in the torrent
--seed Seed the torrent
--bt-trackers <BT_TRACKERS> Trackers for the torrent, e.g. --bt-trackers "udp://tracker.opentrackr.org:1337/announce
,udp://opentracker.io:6969/announce"
--bt-peer-connect-timeout <BT_PEER_CONNECT_TIMEOUT>
Peer connect timeout in seconds. [default: 10]
--bt-peer-read-write-timeout <BT_PEER_READ_WRITE_TIMEOUT>
Peer read/write timeout in seconds. [default: 10]
--bt-peer-keep-alive-interval <BT_PEER_KEEP_ALIVE_INTERVAL>
Peer keep-alive interval in seconds. [default: 120]
--debug Debug output. Print all trackback for debugging
--quiet Quiet mode. Don't show progress bar and task information. But still show the error information
-o, --out <OUT> The path of output for the request e.g. -o "/path/to/file"
-h, --help Print help
-V, --version Print version
Aget can be configured by a configuration file. The file locates at ~/.config/aget/config.
Following options can be set. Aget uses these options as the defaults for each command.
headers = [["key", "value"], ...]
concurrency = ...
chunk_size = "..."
timeout = ...
dns_timeout = ...
retries = ...
retry_wait = ...
If the file does not exist, aget will use the default configuration.
headers = [["user-agent", "aget/version"]]
concurrency = 10
chunk_size = "50m"
timeout = 60
dns_timeout = 10
retries = 5
retry_wait = 0