cURL binding for Zig
var allocator = std.heap.page_allocator;
var f = struct {
fn f(data: []const u8) anyerror!usize {
try std.io.getStdOut().writeAll(data);
return data.len;
}
}.f;
var res = try curl.get("https://google.com/", .{ .allocator = allocator, .cb = f });
if (res != 0) {
var msg = try curl.strerrorAlloc(allocator, res);
defer allocator.free(msg);
std.log.warn("{s}", .{msg});
}
- libcurl
$ zig build
MIT
Yasuhiro Matsumoto (a.k.a. mattn)