anawt

Crates.ioanawt
lib.rsanawt
version0.1.1
created_at2025-12-03 22:50:00.56803+00
updated_at2025-12-23 16:13:20.679496+00
descriptionEasy to use torrent client to embed in your applications
homepage
repositoryhttps://github.com/pliduino/anawt
max_upload_size
id1965444
size38,178
Pedro Liduino (pliduino)

documentation

README

anawt License: MIT anawt on crates.io anawt on docs.rs Source Code Repository

Easy to use torrent client built on top of libtorrent and tokio.

Examples


use anawt::{TorrentClient, options::AnawtOptions, TorrentState};
use tokio::time::{sleep, Duration};

#[tokio::main]
async fn main() {
    let client = TorrentClient::create(AnawtOptions::default());
    let magnet_link = "magnet:?xt=urn:btih:BDBTHK7HMT762DE7RQX7EHPF47TIVID3&dn=nixos-minimal-25.11.650.8bb5646e0bed-x86_64-linux.iso&xl=1584496640";
    let torrent_hash = client.add_magnet(magnet_link, "./downloads").await.unwrap();


    loop {
        // You can also use client.subscribe_torrents() to get torrent updates more efficiently
        let status = client.get_status(torrent_hash).await.unwrap();
        if status.state == TorrentState::Seeding || status.state == TorrentState::Finished {
            break;
        }
        sleep(Duration::from_secs(1)).await;
    }
}
Commit count: 0

cargo fmt