knowledge/technology/applications/cli/network/aria2.md
2024-03-19 09:25:42 +01:00

17 KiB

obj website repo
application https://aria2.github.io/ https://github.com/aria2/aria2

aria2

aria2 is a utility for downloading files. The supported protocols are HTTP(S), FTP, SFTP, BitTorrent, and Metalink. aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. It supports downloading a file from HTTP(S)/FTP/SFTP and BitTorrent at the same time, while the data downloaded from HTTP(S)/FTP/SFTP is uploaded to the BitTorrent swarm. Using Metalink's chunk checksums, aria2 automatically validates chunks of data while downloading a file like BitTorrent. Aria2 can be used as a downloader by yt-dlp.

Usage

aria2c [<OPTIONS>] [<URI>|<MAGNET>|<TORRENT_FILE>|<METALINK_FILE>]

Options

Option Description
-d, --dir=<DIR> The directory to store the downloaded file.
-i, --input-file=<FILE> Downloads the URIs listed in FILE.
-l, --log=<LOG> The file name of the log file. If - is specified, log is written to stdout. If empty string("") is specified, or this option is omitted, no log is written to disk at all.
-j, --max-concurrent-downloads=<N> Set the maximum number of parallel downloads for every queue item.
-V, --check-integrity [true/false] Check file integrity by validating piece hashes or a hash of entire file. This option has effect only in BitTorrent, Metalink downloads with checksums or HTTP(S)/FTP downloads with --checksum option. If piece hashes are provided, this option can detect damaged portions of a file and re-download them. If a hash of entire file is provided, hash check is only done when file has been already download. This is determined by file length. If hash check fails, file is re-downloaded from scratch. If both piece hashes and a hash of entire file are provided, only piece hashes are used. Default: false
-c, --continue [true/false] Continue downloading a partially downloaded file. Use this option to resume a download started by a web browser or another program which downloads files sequentially from the beginning. Currently this option is only applicable to HTTP(S)/FTP downloads.
--checksum=<TYPE>=<DIGEST> Set checksum. TYPE is hash type. The supported hash type is listed in Hash Algorithms in aria2c -v. DIGEST is hex digest. For example, setting sha-1 digest looks like this: sha-1=0192ba11326fe2298c8cb4de616f4d4140213838 This option applies only to HTTP(S)/FTP downloads.
-x, --max-connection-per-server=<NUM> The maximum number of connections to one server for each download. Default: 1
-k, --min-split-size=<SIZE> aria2 does not split less than 2*SIZE byte range. For example, let's consider downloading 20MiB file. If SIZE is 10M, aria2 can split file into 2 range (0-10MiB) and (10MiB-20MiB) and download it using 2 sources(if --split >= 2, of course). If SIZE is 15M, since 2*15M > 20MiB, aria2 does not split file and download it using 1 source. You can append K or M (1K = 1024, 1M = 1024K). Possible Values: 1M -1024M Default: 20M
-o, --out=<FILE> The file name of the downloaded file. It is always relative to the directory given in --dir option.
-s, --split=<N> Download a file using N connections. If more than N URIs are given, first N URIs are used and remaining URIs are used for backup. If less than N URIs are given, those URIs are used more than once so that N connections total are made simultaneously. The number of connections to the same host is restricted by the --max-connection-per-server option. See also the --min-split-size option. Default: 5
-t, --timeout=<SEC> Set timeout in seconds. Default: 60
--check-certificate [true/false] Verify the peer using certificates specified in --ca-certificate option. Default: true
--http-user=<USER>, --http-passwd=<PASSWD> Credentials for HTTP Auth
--header=<HEADER> Append HEADER to HTTP request header. You can use this option repeatedly to specify more than one header:
aria2c --header="X-A: b78" --header="X-B: 9J1" "http://host/file"
--load-cookies=<FILE> Load Cookies from FILE using the Firefox3 format (SQLite3), Chromium/Google Chrome (SQLite3) and the Mozilla/Firefox(1.x/2.x)/Netscape format.
--save-cookies=<FILE> Save Cookies to FILE in Mozilla/Firefox(1.x/2.x)/ Netscape format. If FILE already exists, it is overwritten. Session Cookies are also saved and their expiry values are treated as 0.
-U, --user-agent=<USER_AGENT> Set user agent for HTTP(S) downloads. Default: aria2/$VERSION, $VERSION is replaced by package version.
-S, --show-files [true/false] Print file listing of ".torrent", ".meta4" and ".metalink" file and exit. In case of ".torrent" file, additional information (infohash, piece length, etc) is also printed.
--select-file=<INDEX>... (Torrent) Set file to download by specifying its index. You can find the file index using the --show-files option. Multiple indexes can be specified by using ,, for example: 3,6. You can also use - to specify a range: 1-5. , and - can be used together: 1-5,8,9.