How to Start aria2 Download with Local Metalink File?
This article provides a quick overview and step-by-step guide on how to use a locally saved Metalink file to initiate a download using the aria2 command-line utility. You will learn the exact command syntax, how aria2 processes Metalink files to optimize download speeds, and a few advanced options to customize your download behavior.
Understanding Metalink and aria2
A Metalink file (.metalink or .meta4) is an
XML-formatted file that contains metadata about a download. Instead of
pointing to a single file on a single server, a Metalink file lists
multiple sources (mirrors, BitTorrent torrents, and cryptographic
checksums) for the same file. When you feed this file to aria2, the
utility automatically downloads segments of the file from different
sources simultaneously, maximizing your bandwidth and ensuring file
integrity.
The Command Syntax
To start a download using a local Metalink file, you need to open
your terminal or command prompt and pass the path of the
.metalink file directly to the aria2c
command.
The basic command structure is as follows:
aria2c /path/to/your/file.metalinkIf you are already inside the directory where your Metalink file is saved, you can simply run:
aria2c example.metalinkAdvanced Options for Metalink Downloads
While the default command works perfectly for most scenarios, aria2 offers specific flags to give you more control over how the Metalink file is handled.
- Specify Download Directory: By default, aria2
downloads the files into your current working directory. You can change
this by using the
-dflag.
aria2c -d /path/to/download/folder example.metalink- Select Specific Files: If the Metalink file
contains a package of multiple files and you only want to download
specific ones, you can use the
--select-fileoption. You will first need to see the file indices, which aria2 displays when you run the initial command, and then pass those numbers.
aria2c --select-file=1,3 example.metalink- Disable Torrent Sources: If the Metalink file contains both HTTP/FTP mirrors and BitTorrent links, but you want to avoid using Peer-to-Peer (P2P) networks, you can disable torrents explicitly.
aria2c --metalink-enable-unique-protocol=false example.metalinkError Troubleshooting
If aria2 fails to parse your file, ensure that the file is not corrupted and follows proper XML formatting. Additionally, verify that your terminal has the correct read permissions for the local file path you provided.