A simple BitTorrent CLI client written in C++.
It supports downloading from both .torrent files and magnet links, with piece-level control for magnet downloads.
- Download files using a
.torrentfile. - Download specific pieces from a magnet link.
- Command-line interface (no GUI).
- Lightweight and minimal dependencies.
git clone https://github.com/rahulsenna/bittorrent-cpp.git
cd bittorrent-cpp
mkdir build && cd build
cmake ..
makeThe binary will be available in the build/ directory.
./bittorrent-cpp download -o out_file sample.torrent-o out_file→ output file pathsample.torrent→ path to the torrent file
./bittorrent-cpp magnet_download_piece -o out_file "<magnet-link>" <piece_index>-o out_file→ output file path<magnet-link>→ the magnet URI<piece_index>→ index of the piece to download
./bittorrent-cpp download -o ubuntu.iso ubuntu.torrent./bittorrent-cpp magnet_download_piece -o chunk.bin "magnet:?xt=urn:btih:..." 5This project is under active development. Currently supports:
- Parsing
.torrentfiles - Parsing magnet URIs
- Downloading via BitTorrent protocol
Planned improvements:
- Multi-piece downloads for magnet links
- Peer management & choking/unchoking
- Upload/seeding support
Contributions, issues, and feature requests are welcome! Feel free to fork the repo and submit a PR.
This project is licensed under the MIT License – see the LICENSE file for details.