Save Torrent Metadata as .torrent in aria2?
This article provides a quick overview and step-by-step guide on how
to configure the aria2 download utility to automatically save torrent
metadata as a local .torrent file when starting downloads
from magnet links. By default, aria2 fetches this metadata to start your
download but discards it afterward. By utilizing specific command-line
flags or configuration file settings, you can preserve these files for
backing up your torrent library, seeding from other clients, or sharing
the metadata directly.
The Core Configuration Options
To force aria2 to retain the .torrent file after
processing a magnet link, you need to use two specific configuration
options: bt-save-metadata and
bt-metadata-only.
Here is how these two settings work:
bt-save-metadata=true: This tells aria2 to save the metadata fetched from the magnet link as a.torrentfile in your designated download directory. The filename will typically be the hex hash of the torrent followed by the.torrentextension.bt-metadata-only=true(Optional): If your goal is only to download the.torrentfile and not the actual content of the torrent itself, setting this to true will make aria2 stop downloading immediately after the metadata file is secured.
Implementing via Command Line
If you are running aria2 on an ad-hoc basis from the terminal, you can append these options directly to your execution command.
aria2c --bt-save-metadata=true "magnet:?xt=urn:btih:..."If you only want the .torrent file and want to skip
downloading the payload files, use:
aria2c --bt-save-metadata=true --bt-metadata-only=true "magnet:?xt=urn:btih:..."Implementing via Configuration File
For a permanent solution that applies to all future magnet link
downloads, you can add these parameters to your global aria2
configuration file (usually named aria2.conf).
- Open your
aria2.conffile in a text editor. - Add the following lines to the file:
# Save torrent metadata to a local .torrent file
bt-save-metadata=true
# Uncomment the line below if you only want the metadata and no data files
# bt-metadata-only=true
- Save and close the file.
Once configured globally, any magnet link passed to aria2 will
automatically generate a corresponding .torrent file in the
output directory.