benko 2.0.2

A zero dependency bencode parser/encoder.
Documentation
  • Coverage
  • 49.12%
    28 out of 57 items documented0 out of 34 items with examples
  • Size
  • Source code size: 23.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tijb

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. :)