torita is a torrent-aware package downloader.


torita makes it easy to download packages via the bittorrent protocol. For each package to be downloaded, torita first tries to use bittorrent protocol with existing torrent, and fallback to plain download if torrent is not available. After plain download is completed, torita makes a torrent of the downloaded package so that future downloads of the same package can be done through bittorrent.


Use with pacman

torita is designed to easily fit into the popular package manager pacman. To use torita with pacman, set it as XferCommand in /etc/pacman.conf with a line like this:

XferCommand = /usr/bin/torita -o %o %u

And you are all set.

By default, torita maintains its torrent cache at /var/cache/torita. The torrent cache is automatically filled when you use torita with pacman.

Use with other package managers

If your package manager lets you choose the package downloader, then you can set torita as the package downloader in a way that is specific to your package manager.

The default package name suffix is .pkg.tar.xz. If your package manager uses a different one, then you need to set the --package-suffix option:

torita --package-suffix=.deb ...

If your package manager doesn’t give you the option of choosing custom package downloader, then you can manually fill and download packages using the torrent cache as stated below in Use without a package manager, and install packages using commands which read from local files such as dpkg -i.

Use without a package manager

You can directly call torita to manually fill the torrent cache while downloading the package you want:

torita --torrent-directory=/tmp/mytorrents <url>    # torrent doesn't exist and will be made

Later downloads of the same file can use bt with this torrent cache:

torita --torrent-directory=/tmp/mytorrents <url>    # torrent exists and bt is used

If all you want is the torrent cache (but not the packages themselves), then you can download to the same temporary file and delete it afterwards:

torita --torrent-directory=/tmp/mytorrents -o /tmp/mytmpfile <url1>
torita --torrent-directory=/tmp/mytorrents -o /tmp/mytmpfile <url2>
torita --torrent-directory=/tmp/mytorrents -o /tmp/mytmpfile <url3>
rm /tmp/mytmpfile

This also works of course:

torita --torrent-directory=/tmp/mytorrents -o /tmp/mytmpfile <url1>
rm /tmp/mytmpfile
torita --torrent-directory=/tmp/mytorrents -o /tmp/mytmpfile <url2>
rm /tmp/mytmpfile
torita --torrent-directory=/tmp/mytorrents -o /tmp/mytmpfile <url3>
rm /tmp/mytmpfile

Use for non-package files

In fact, you can use torita for any types of files (even for non-package files) that you want to torify (i.e. make a torrent of the file and keep the file so that future downloads of the same file can use the bittorrent protocol). Depending on the file you want to torify, you may need to call torita with the torrent cache directory, the (non-)package name, the (non-)package suffix and the output filename:

torita -o /tmp/output.wav \
    --package-name=test.wav \
    --package-suffix=.wav \
    --torrent-directory=/tmp/mytorrents \

The above command uses plain download to download a file from to /tmp/output.wav and creates a torrent file in directory /tmp/mytorrents containing a single file test.wav. The torrent filename will be the same as the (non-)package name with a .torrent suffix (test.wav.torrent here).

When this command is run again, it will notice there exists a torrent file in the cache and will download the file using bittorrent. Since the filename in the torrent is test.wav, you need to explicitly specify the output filename if you want to name it differently (/tmp/output.wav here).


Torrent Cache Management

To make things easy, the torrent cache is designed as a flat directory. You can freely add, modify, delete torrents as you want with any tool you like. However, make sure their filenames and contents are as expected by your package manager. Otherwise, incorrect files may be downloaded which can render your system nonfunctional.


Not all files are suitable for torification. An example is package database. Even though it always has the same url, its contents are continuously updated, which quickly makes a torrent obsolete. In contrast, packages themselves have fixed version numbers and constant contents, which make them ideal objects for torification.

torita addresses this issue through the use of package suffix. In particular, torita is torrent-aware only when the package name has the specified package suffix. You can set the package suffix to empty to bypass this suffix check.


torita is designed for package management where such concurrency is delegated to the package manager. If you don’t run package managers concurrently, then don’t run torita concurrently. If you do run package managers concurrently, then you are likely to get some errors.


This file is part of torita.

torita is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

torita is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with torita. If not, see