How to Check Aria2 Download Link Without Downloading?
To verify the validity and details of a download link in aria2
without actually fetching the full file, you can use the
--dry-run parameter. This command allows aria2 to connect
to the server, validate the URL, and check file availability or size
while skipping the actual data download. It is an efficient way to test
URLs and troubleshoot scripts before committing time and bandwidth to a
complete transfer.
Testing Download Links with the Aria2 Dry-Run Parameter
When managing automated scripts or handling large batches of
downloads, verifying that your source links are active and correct is
crucial. The aria2c command-line tool provides a built-in
mechanism exactly for this purpose.
The --dry-run Command
By appending --dry-run to your execution string, aria2
performs all the initial handshakes and requests required to start a
download, but it terminates the process immediately before writing the
file to your disk.
aria2c --dry-run "https://example.com/file.zip"What Happens During a Dry Run?
When you execute this command, aria2 goes through the following steps:
- DNS Resolution: Resolves the domain name of the host server.
- Server Connection: Establishes a connection to the remote server.
- HTTP/FTP Handshake: Sends the initial request headers to the server.
- Link Validation: Checks if the file exists (returning a 200 OK status or an error like 404 Not Found).
- Metadata Retrieval: If successful, it prints out file information, such as the total file size and content type, before safely disconnecting.