{"id":13998649,"url":"https://github.com/beho/zig-csv","last_synced_at":"2025-07-23T06:32:41.925Z","repository":{"id":43182625,"uuid":"325826954","full_name":"beho/zig-csv","owner":"beho","description":"Low-level CSV parser library for Zig language.","archived":false,"fork":false,"pushed_at":"2024-06-09T08:50:35.000Z","size":41,"stargazers_count":19,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-30T01:34:42.738Z","etag":null,"topics":["csv","zig"],"latest_commit_sha":null,"homepage":"","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/beho.png","metadata":{"files":{"readme":"README.md","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":"2020-12-31T15:31:40.000Z","updated_at":"2024-10-24T01:00:48.000Z","dependencies_parsed_at":"2024-04-22T17:52:42.956Z","dependency_job_id":"7de8a4ea-bf99-48c6-a923-5ff0a469f753","html_url":"https://github.com/beho/zig-csv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beho/zig-csv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beho%2Fzig-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beho%2Fzig-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beho%2Fzig-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beho%2Fzig-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beho","download_url":"https://codeload.github.com/beho/zig-csv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beho%2Fzig-csv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266631358,"owners_count":23959419,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csv","zig"],"created_at":"2024-08-09T19:01:53.182Z","updated_at":"2025-07-23T06:32:41.577Z","avatar_url":"https://github.com/beho.png","language":"Zig","funding_links":[],"categories":["Zig"],"sub_categories":[],"readme":"# zig-csv ![CI](https://github.com/beho/zig-csv/workflows/CI/badge.svg)\n\nLow-level CSV parser library for [Zig language](https://github.com/ziglang/zig). Each non-empty line in input is parsed as one or more tokens of type `field`, followed by `row_end`.\n\n_This library was conceived as Zig learning project and it was not used by me in production software._\n\n## Features\n\n- Reads UTF-8 files.\n- Provides iterator interface to stream of tokens.\n- Handles quoted fields in which column/row separator can be used. Quote itself can be used in field by doubling it (e.g. `\"This is quote: \"\".\"`)\n- Configurable column separator (default `,`), row separator (`\\n`) and quote (`\"`).\n  - **Currently only single byte characters.**\n- Parser does not allocate – caller provides a buffer that parser operates in. **Buffer must be longer than a longest field in input.**\n\n## Example\n\nFollowing code reads CSV tokens from a file while very naively printing them as table to standard output.\n\n```zig\nconst std = @import(\"std\");\nconst csv = @import(\"csv\");\n\npub fn main() anyerror!void {\n    var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);\n    defer arena.deinit();\n\n    const allocator = \u0026arena.allocator;\n    var buffer = try allocator.alloc(u8, 4096);\n\n    const args = try std.process.argsAlloc(allocator);\n    defer std.process.argsFree(allocator, args);\n\n    if (args.len != 2) {\n        std.log.warn(\"Single arg is expected\", .{});\n        std.process.exit(1);\n    }\n\n    const file = try std.fs.cwd().openFile(args[1], .{});\n    defer file.close();\n\n    var csv_tokenizer = try csv.CsvTokenizer(std.fs.File.Reader).init(file.reader(), buffer, .{});\n    const stdout = std.io.getStdOut().writer();\n\n    while (try csv_tokenizer.next()) |token| {\n        switch (token) {\n            .field =\u003e |val| {\n                try stdout.writeAll(val);\n                try stdout.writeAll(\"\\t\");\n            },\n            .row_end =\u003e {\n                try stdout.writeAll(\"\\n\");\n            },\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeho%2Fzig-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeho%2Fzig-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeho%2Fzig-csv/lists"}