{"id":13711117,"url":"https://github.com/jiacai2050/zig-curl","last_synced_at":"2025-04-12T02:01:54.670Z","repository":{"id":195328251,"uuid":"692468001","full_name":"jiacai2050/zig-curl","owner":"jiacai2050","description":"Zig bindings for libcurl","archived":false,"fork":false,"pushed_at":"2024-05-12T12:41:29.000Z","size":3111,"stargazers_count":47,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-13T05:22:58.178Z","etag":null,"topics":["libcurl","libcurl-binding","libcurl-bindings","zig","zig-lib","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"https://jiacai2050.github.io/zig-curl/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jiacai2050.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-16T15:13:59.000Z","updated_at":"2024-05-30T02:01:29.344Z","dependencies_parsed_at":"2023-12-23T05:18:40.227Z","dependency_job_id":"8426ef8a-54ab-420c-a784-7347e9630ae7","html_url":"https://github.com/jiacai2050/zig-curl","commit_stats":null,"previous_names":["jiacai2050/zig-curl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzig-curl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzig-curl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzig-curl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiacai2050%2Fzig-curl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiacai2050","download_url":"https://codeload.github.com/jiacai2050/zig-curl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505862,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["libcurl","libcurl-binding","libcurl-bindings","zig","zig-lib","zig-package","ziglang"],"created_at":"2024-08-02T23:01:04.677Z","updated_at":"2025-04-12T02:01:54.641Z","avatar_url":"https://github.com/jiacai2050.png","language":"Zig","funding_links":[],"categories":["Zig","Interoperability"],"sub_categories":["FFI Bindings"],"readme":"#+TITLE: zig-curl\n#+DATE: 2023-09-16T23:16:15+0800\n#+LASTMOD: 2025-03-09T10:42:45+0800\n#+OPTIONS: toc:nil num:nil\n#+STARTUP: content\n\n[[https://img.shields.io/badge/zig%20version-0.14.0-blue.svg]]\n[[https://img.shields.io/badge/zig%20version-master-blue.svg]]\n[[https://github.com/jiacai2050/zig-curl/actions/workflows/CI.yml][https://github.com/jiacai2050/zig-curl/actions/workflows/CI.yml/badge.svg]]\n[[https://ci.codeberg.org/repos/13257][https://ci.codeberg.org/api/badges/13257/status.svg]]\n\nZig bindings for [[https://curl.haxx.se/libcurl/][libcurl]], a free and easy-to-use client-side URL transfer library.\n\n#+begin_quote\nThis package is in early stage, although the core functionality works right now, the API is still subject to changes.\n#+end_quote\n\nThe vendored libraries consist of:\n| Library | Version |\n|---------+---------|\n| libcurl | [[https://github.com/curl/curl/tree/curl-8_8_0][8.8.0]]   |\n| zlib    | [[https://github.com/madler/zlib/tree/v1.3.1][1.3.1]]   |\n| mbedtls | [[https://github.com/Mbed-TLS/mbedtls/tree/v3.6.0][3.6.0]]   |\n\n* Usage\n#+begin_src zig\nconst curl = @import(\"curl\");\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer if (gpa.deinit() != .ok) @panic(\"leak\");\n    const allocator = gpa.allocator();\n\n    const easy = try curl.Easy.init(allocator, .{});\n    defer easy.deinit();\n\n    const resp = try easy.get(\"http://httpbin.org/anything\");\n    defer resp.deinit();\n\n    std.debug.print(\"Status code: {d}\\nBody: {s}\\n\", .{\n        resp.status_code,\n        resp.body.items,\n    });\n}\n#+end_src\nSee [[file:examples/basic.zig]], [[file:examples/advanced.zig]] for more usage.\n\n* Installation\n#+begin_src bash\nzig fetch --save=curl https://github.com/jiacai2050/zig-curl/archive/${COMMIT}.tar.gz\n#+end_src\n\nReplace ~${COMMIT}~ with a real one, then in your =build.zig=, import the module like this:\n#+begin_src zig\nconst dep_curl = b.dependency(\"curl\", .{});\nexe.root_module.addImport(\"curl\", dep_curl.module(\"curl\"));\nexe.linkLibC();\n#+end_src\n\nThis library will link to a vendored libcurl by default, you can disable it and link to system-wide with this\n#+begin_src zig\nconst dep_curl = b.dependency(\"curl\", .{ .link_vendor = false });\nexe.linkSystemLibrary(\"curl\");\nexe.linkLibC();\n#+end_src\n\n* License\n[[file:LICENSE][MIT]]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiacai2050%2Fzig-curl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiacai2050%2Fzig-curl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiacai2050%2Fzig-curl/lists"}