knowledge/technology/applications/cli/aria2.md

89 lines
4.5 KiB
Markdown
Raw Normal View History

2023-12-04 10:02:23 +00:00
---
obj: application
os:
- linux
website: https://aria2.github.io/
repo: https://github.com/aria2/aria2
---
# aria2
[Repo](https://github.com/aria2/aria2)
#refactor
[aria2](https://aria2.github.io/) is a utility for downloading files. The supported protocols are [HTTP](../../internet/HTTP.md)(S), FTP, SFTP, [BitTorrent](../../tools/BitTorrent.md), 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](../../internet/HTTP.md)(S)/FTP/SFTP and [BitTorrent](../../tools/BitTorrent.md) at the same time, while the data downloaded from [HTTP](../../internet/HTTP.md)(S)/FTP/SFTP is uploaded to the [BitTorrent](../../tools/BitTorrent.md) swarm. Using Metalink's chunk checksums, aria2 automatically validates chunks of data while downloading a file like [BitTorrent](../../tools/BitTorrent.md). Aria2 can be used as a downloader by [yt-dlp](../media/yt-dlp.md).
## Usage
```shell
aria2c [<OPTIONS>] [<URI>|<MAGNET>|<TORRENT_FILE>|<METALINK_FILE>]
```
### Options
- The directory to store the downloaded file.
```shell
-d, --dir=<DIR>
```
- Downloads the URIs listed in **FILE**.
```shell
-i, --input-file=<FILE>
```
- Set the maximum number of parallel downloads for every queue item.
```shell
-j, --max-concurrent-downloads=<N>
```
- Check file integrity by validating piece hashes or a hash of entire file. This option has effect only in [BitTorrent](../../tools/BitTorrent.md), Metalink downloads with checksums or [HTTP](../../internet/HTTP.md)(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
```shell
-V, --check-integrity [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](../../internet/HTTP.md)(S)/FTP downloads.
```shell
-c, --continue [true|false]
```
- 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](../../internet/HTTP.md)(S)/FTP downloads.
```shell
--checksum=<TYPE>=<DIGEST>
```
- The maximum number of connections to one server for each download.  Default: **1**
```shell
-x, --max-connection-per-server=<NUM>
```
- 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
```shell
-k, --min-split-size=<SIZE>
```
- The file name of the downloaded file.  It is always relative to the directory given in --dir option.
```shell
-o, --out=<FILE>
```
- 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
```shell
-s, --split=<N>
```
- Verify the peer using certificates specified in --ca-certificate option. Default: true
```shell
--check-certificate [true|false]
```
- [HTTP](../../internet/HTTP.md) Auth
```shell
--http-user=<USER>
--http-passwd=<PASSWD>
```
- Load Cookies from FILE using the Firefox3 format (SQLite3), Chromium/Google Chrome (SQLite3) and the Mozilla/[Firefox](../network/browsers/Firefox.md)(1.x/2.x)/Netscape format.
```shell
--load-cookies=<FILE>
```
- Save Cookies to FILE in Mozilla/[Firefox](../network/browsers/Firefox.md)(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. Possible Values: /path/to/file
```shell
--save-cookies=<FILE>
```