pd0wm / bencode-rust

Parse .torrent files in rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bencode rust

Parse .torrent file:

use std::fs;
use bittorrent::bdecode::parse;

fn main() {
    let contents = fs::read("assets/debian-10.3.0-amd64-netinst.iso.torrent").unwrap();
    let torrent = parse(&contents).unwrap().1.get_dict();
    let comment = torrent.get("comment").unwrap().get_string(); // "Debian CD from cdimage.debian.org"
}

See main.rs for more examples on how to use the parser.

About

Parse .torrent files in rust

License:MIT License


Languages

Language:Rust 100.0%