Aria2中文说明文档

文档大纲

本文档并未完全翻译完成,我需要你的帮助。前往GitHub编辑

EXAMPLE

HTTP/FTP 分段下载

Download a file

$ aria2c "http://host/file.zip"
                    

注意

To stop a download, press Ctrl-C. You can resume the transfer by running aria2c with the same argument in the same directory. You can change URIs as long as they are pointing to the same file.

Download a file from two different HTTP servers

$ aria2c "http://host/file.zip" "http://mirror/file.zip"
                    

Download a file from one host using multiple connections

$ aria2c -x2 -k1M "http://host/file.zip"
                    

注意

The -x option specified the number of allowed connections, while the -k option specified the size of chunks.

Download a file from HTTP and FTP servers at the same time

$ aria2c "http://host1/file.zip" "ftp://host2/file.zip"
                    

Download files listed in a text file concurrently

$ aria2c -ifiles.txt -j2
                      

注意

-j option specifies the number of parallel downloads.

Using a proxy

For HTTP:

$ aria2c --http-proxy="http://proxy:8080" "http://host/file"
                    
$ aria2c --http-proxy="http://proxy:8080" --no-proxy="localhost,127.0.0.1,192.168.0.0/16" "http://host/file"
                    

For FTP:

$ aria2c --ftp-proxy="http://proxy:8080" "ftp://host/file"
                    

注意

See --http-proxy, --https-proxy, --ftp-proxy, --all-proxy and --no-proxy for details. You can specify proxy in the environment variables. See ENVIRONMENT section.

Using a Proxy with authorization

$ aria2c --http-proxy="http://username:password@proxy:8080" "http://host/file"
                    
$ aria2c --http-proxy="http://proxy:8080" --http-proxy-user="username" --http-proxy-passwd="password" "http://host/file"
                    

BitTorrent 下载

Download files using a remote BitTorrent file

$ aria2c --follow-torrent=mem "http://host/file.torrent"
                    

Download using a local torrent file

$ aria2c --max-upload-limit=40K file.torrent
                    

注意

--max-upload-limit specifies the max of upload rate.

注意

To stop a download, press Ctrl-C. You can resume the transfer later by running aria2c with the same argument in the same directory.

Download using BitTorrent Magnet URI

$ aria2c "magnet:?xt=urn:btih:248D0A1CD08284299DE78D5C1ED359BB46717D8C&dn=aria2"
                    

注意

Don't forget to quote BitTorrent Magnet URIs which include & characters with single(') or double(") quotes when specifying URIs on the command-line.

Download 2 torrents

$ aria2c -j2 file1.torrent file2.torrent
                    

Download a file via torrent and HTTP/FTP server in parallel

$ aria2c -Ttest.torrent "http://host1/file" "ftp://host2/file"
                    

Only download specific files (usually called "selected download")

$ aria2c --select-file=1-4,8 file.torrent
                    

注意

The index is printed to the console using -S option.

Download a .torrent file, but do not download the torrent

$ aria2c --follow-torrent=false "http://host/file.torrent"
                    

Specify the output file name

To specify the output file name for BitTorrent downloads, you need to know the index of file in the torrent (see --show-files). For example, the output looks like this:

idx|path/length
                    ===+======================
                      1|dist/base-2.6.18.iso
                       |99.9MiB
                    ---+----------------------
                      2|dist/driver-2.6.18.iso
                       |169.0MiB
                    ---+----------------------
                    

To save 'dist/base-2.6.18.iso' in '/tmp/mydir/base.iso' and 'dist/driver-2.6.18.iso' in '/tmp/dir/driver.iso', use the following command:

$ aria2c --dir=/tmp --index-out=1=mydir/base.iso --index-out=2=dir/driver.iso file.torrent
                    

Change the listening ports for incoming peer connections

$ aria2c --listen-port=7000-7001,8000 file.torrent
                    

注意

Since aria2 doesn't configure firewalls or routers for port forwarding, it's up to you to do so manually.

Specify conditions to stop seeding after torrent downloads finish

$ aria2c --seed-time=120 --seed-ratio=1.0 file.torrent
                    

注意

In the above example, the program stops seeding after 120 minutes since download completed or seed ratio reaches 1.0.

Throttle upload speed

$ aria2c --max-upload-limit=100K file.torrent
                    

Enable IPv4 DHT

$ aria2c --enable-dht --dht-listen-port=6881 file.torrent
                    

注意

DHT uses UDP. Since aria2 doesn't configure firewalls or routers for port forwarding, it's up to you to do it manually.

Enable IPv6 DHT

$ aria2c --enable-dht6 --dht-listen-port=6881 --dht-listen-addr6=YOUR_GLOBAL_UNICAST_IPV6_ADDR
                    

注意

aria2 uses the same ports as IPv4 for IPv6.

Add and remove tracker URIs

Ignore all tracker announce URIs defined in file.torrent and use http://tracker1/announce and http://tracker2/announce instead:

$ aria2c --bt-exclude-tracker="*" --bt-tracker="http://tracker1/announce,http://tracker2/announce" file.torrent
                    

更多高级 HTTP 特性

Load cookies

$ aria2c --load-cookies=cookies.txt "http://host/file.zip"
                    

注意

You can use Firefox/Mozilla/Chromium's cookie files without modification.

Resume download started by web browsers or other programs

$ aria2c -c -s2 "http://host/partiallydownloadedfile.zip"
                    

注意

This will only work when the initial download was not multi-segmented.

Client certificate authorization for SSL/TLS

Specify a PKCS12 file as follows:

$ aria2c --certificate=/path/to/mycert.p12
                    

注意

The file specified in --certificate must be contain one PKCS12 encoded certificate and key. The password must be blank.

Alternatively, if PEM files are supported, use a command like the following:

$ aria2c --certificate=/path/to/mycert.pem --private-key=/path/to/mykey.pem https://host/file
                    

注意

The file specified in --private-key must be decrypted. The behavior when encrypted one is given is undefined.

Verify SSL/TLS servers using given CA certificates

$ aria2c --ca-certificate=/path/to/ca-certificates.crt --check-certificate https://host/file
                    

注意

This option is only available when aria2 was compiled against GnuTLS or OpenSSL. WinTLS and AppleTLS will always use the system certificate store. Instead of `--ca-certificate install the certificate in that store.

RPC

Encrypt RPC traffic with SSL/TLS

Specify a server PKC12 file:

$ aria2c --enable-rpc --rpc-certificate=/path/to/server.p12 --rpc-secure
                    

注意

The file specified in --rpc-certificate must be contain one PKCS12 encoded certificate and key. The password must be blank.

Alternatively, when PEM files are supported (GnuTLS and OpenSSL), specify the server certificate file and private key file as follows:

$ aria2c --enable-rpc --rpc-certificate=/path/to/server.crt --rpc-private-key=/path/to/server.key --rpc-secure
                    

更多高级特性

Throttle the download speed

Per-download:

$ aria2c --max-download-limit=100K file.metalink
                    

Overall:

$ aria2c --max-overall-download-limit=100K file.metalink
                    

Repair a damaged download

$ aria2c -V file.metalink
                    

注意

Repairing damaged downloads can be done efficiently when used with BitTorrent or Metalink with chunk checksums.

Drop connections if download speed is lower than a specified limit

$ aria2c --lowest-speed-limit=10K file.metalink
                    

Parameterized URI support

You can specify set of parts:

$ aria2c -P "http://{host1,host2,host3}/file.iso"
                    

You can specify numeric sequence:

$ aria2c -Z -P "http://host/image[000-100].png"
                    

注意

The -Z option is required if the URIs don't point to the same file, such as in the above example.

You can specify step counter:

$ aria2c -Z -P "http://host/image[A-Z:2].png"
                    

Verifying checksums

$ aria2c --checksum=sha-1=0192ba11326fe2298c8cb4de616f4d4140213837 http://example.org/file
                    

BitTorrent Encryption

Encrypt the whole payload using ARC4 (obfuscation):

$ aria2c --bt-min-crypto-level=arc4 --bt-require-crypto=true file.torrent