Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nektro/zig-bencode
Bencode parser for Zig.
https://github.com/nektro/zig-bencode
bencode zig zig-package
Last synced: 3 months ago
JSON representation
Bencode parser for Zig.
- Host: GitHub
- URL: https://github.com/nektro/zig-bencode
- Owner: nektro
- License: mit
- Created: 2021-04-04T12:26:06.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-06T22:24:13.000Z (3 months ago)
- Last Synced: 2024-11-06T23:24:55.573Z (3 months ago)
- Topics: bencode, zig, zig-package
- Language: Zig
- Homepage:
- Size: 45.9 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zig-bencode
![loc](https://sloc.xyz/github/nektro/zig-bencode)Bencode parser for Zig.
Uses the [Zigmod](https://github.com/nektro/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`
```yml
dependencies:
- src: git https://github.com/nektro/zig-bencode
```In your code
```zig
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