Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zon-dev/mime
Support MIME (HTTP Media Types) types parse in Zig.
https://github.com/zon-dev/mime
media-types mime mime-parser mime-types zig zig-package ziglang
Last synced: 28 days ago
JSON representation
Support MIME (HTTP Media Types) types parse in Zig.
- Host: GitHub
- URL: https://github.com/zon-dev/mime
- Owner: zon-dev
- License: mit
- Created: 2024-08-03T09:44:54.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-06T08:30:11.000Z (3 months ago)
- Last Synced: 2024-10-02T07:04:00.686Z (about 1 month ago)
- Topics: media-types, mime, mime-parser, mime-types, zig, zig-package, ziglang
- Language: Zig
- Homepage: https://zon.dev
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mime
Support MIME (HTTP Media Types) types parse in Zig.### Usage:
```zig
var mime = Mime.parse(std.heap.page_allocator, "text/plain; charset=utf-8; foo=bar");
try std.testing.expect(mime != null);
try std.testing.expect(std.mem.eql(u8, mime.?.essence, "text/plain; charset=utf-8; foo=bar"));
try std.testing.expect(std.mem.eql(u8, mime.?.basetype, "text"));
try std.testing.expect(std.mem.eql(u8, mime.?.subtype, "plain"));const charset = mime.?.getParam("charset");
try testing.expectEqualStrings("utf-8", charset.?);const foo = mime.?.getParam("foo");
try testing.expectEqualStrings("bar", foo.?);const bar = mime.?.getParam("bar");
try testing.expect(bar == null);
```