1/nektro/bencode v0.5


zig-bencode

loc

Bencode parser for Zig.

Uses the Zigmod package manager.

https://en.wikipedia.org/wiki/Bencode

https://www.bittorrent.org/beps/bep_0003.html#bencoding

Usage

Add the following to the bottom of your zig.mod

dependencies:
  - src: git https://github.com/nektro/zig-bencode

In your code

const bencode = @import("bencode");

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    const alloc = &gpa.allocator;

    const file = @embedFile("./some/path/to.torrent");
    var buf = std.io.fixedBufferStream(file);
    const r = buf.reader();
    const ben = try bencode.parse(r, alloc);

    // do something with `ben`...
}

License

MIT

Package Contents

  • .gitattributes
  • LICENSE
  • zig.sum
  • build.zig
  • archlinux-2021.04.01-x86_64.iso.torrent
  • src/lib.zig
  • src/main.zig
  • README.md
  • zig.mod
  • build.zig.zon
  • .gitignore

History

Published On Tree @ Commit Size
v0.5 Wed, 06 Nov 2024 22:24:15 UTC Tree 39.693 KB
v0.4 Wed, 07 Jun 2023 05:41:07 UTC Tree 39.147 KB
v0.3 Sat, 03 Jun 2023 19:21:02 UTC Tree 37.566 KB
v0.2 Fri, 02 Jun 2023 10:34:36 UTC Tree 37.102 KB
v0.1 Mon, 12 Apr 2021 11:04:31 UTC Tree 35.080 KB