benko

Crates.iobenko
lib.rsbenko
version2.0.2
sourcesrc
created_at2021-01-28 02:53:31.614433
updated_at2021-02-24 03:36:51.06142
descriptionA zero dependency bencode parser/encoder.
homepage
repositoryhttps://github.com/tijb/benko
max_upload_size
id347529
size23,678
tim bangma (tijb)

documentation

README

benko

A zero dependency bencode parser and encoder written in rust.

Want to use benko for Torrents? check out tijb/torq

Getting Started

Check out the docs. docs.rs/benko

Examples

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();

Issues?

Feel free to put up a Pull Request, or open an Issue. :)

Commit count: 0

cargo fmt