Crates.io | benko |
lib.rs | benko |
version | 2.0.2 |
source | src |
created_at | 2021-01-28 02:53:31.614433 |
updated_at | 2021-02-24 03:36:51.06142 |
description | A zero dependency bencode parser/encoder. |
homepage | |
repository | https://github.com/tijb/benko |
max_upload_size | |
id | 347529 |
size | 23,678 |
A zero dependency bencode parser and encoder written in rust.
Want to use benko for Torrents? check out tijb/torq
Check out the docs. docs.rs/benko
read from a file
let bytes: Vec<u8> = std::fs::read("my_file.torrent")
.expect("Couldn't read file.");
let bencode: Benc = Benc::parse(bytes)
.expect("Couldn't parse bencode bytes");
encode to bytes
let bencode: Benc = Benc::Int(9001);
let bytes: Vec<u8> = bencode.bytes();
Feel free to put up a Pull Request, or open an Issue. :)