Skip to content

iansimonson/zben

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zben

Zig Bencode Parser

Super basic Bencode parsing into a bencode Value which could be a Integer, String, List, or Dictionary.

Got the decoding done only to find zig bencode encoding/decoding libraries exist :) so will probably abandon this now.

Example Usage

const zben = @import("zben");
const gpa = std.heap.GeneralPurposeAllocator(.{}){};
const alloc = &gpa.allocator;

pub fn main() !void {
    const str = "d4:testi50ee";
    var parser = zben.Parser.initWithData(alloc, str);
    defer parser.deinit();

    var tree = try parser.parse();
    defer tree.deinit();

    // do things with the tree.root
}

About

Zig Bencode Parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages