I decided to learn Zig a couple of weeks ago and realized my starting project required identifying file types (in particular, if a file is a text/binary file). I found some libraries around (including libmagic) but could not find anything written purely in Zig (probably because I didn’t search well enough). So, I wrote zmime (GitHub - avac74/zmime: A dependency‑free file type detection library written in Zig.)
This is pretty much my first (real) project with Zig. Any suggestions to improve functionality and to make the code more idiomatic are very much welcomed!
This is fantastic! I was looking at using libmagic for my project a few days ago but shelved it since I didn’t wanna deal with translateC at the time. Will for sure try it out once I have some time.
I updated your lib to 0.16.0 using std.Io stuff. But since I stopped using GitHub, I can’t open a PR to your repo. Instead I created a Codeberg repo which is clearly marked as a fork of yours:
Please feel free to merge the changes into your upstream GitHub repo. So far, I haven’t made additions to your original code, only updated deprecated functions etc.
Edit: I also updated and merged your add_encoding branch.