{"id":31655485,"url":"https://github.com/ndrean/zig-zstd","last_synced_at":"2025-10-07T13:14:39.366Z","repository":{"id":318312005,"uuid":"1070739075","full_name":"ndrean/zig-zstd","owner":"ndrean","description":"Tiny Zig wrapper of libzstd","archived":false,"fork":false,"pushed_at":"2025-10-06T12:22:08.000Z","size":7284,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T13:27:40.255Z","etag":null,"topics":["zig","zig-package"],"latest_commit_sha":null,"homepage":"https://ndrean.github.io/zig-zstd","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ndrean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-06T11:24:44.000Z","updated_at":"2025-10-06T12:22:12.000Z","dependencies_parsed_at":"2025-10-06T13:27:46.282Z","dependency_job_id":null,"html_url":"https://github.com/ndrean/zig-zstd","commit_stats":null,"previous_names":["ndrean/zig-zstd"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ndrean/zig-zstd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndrean%2Fzig-zstd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndrean%2Fzig-zstd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndrean%2Fzig-zstd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndrean%2Fzig-zstd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndrean","download_url":"https://codeload.github.com/ndrean/zig-zstd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndrean%2Fzig-zstd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278780059,"owners_count":26044492,"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-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["zig","zig-package"],"created_at":"2025-10-07T13:14:38.150Z","updated_at":"2025-10-07T13:14:39.358Z","avatar_url":"https://github.com/ndrean.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# z-std\n\n![Zig support](https://img.shields.io/badge/Zig-0.15.1-color?logo=zig\u0026color=%23f3ab20)\n\nA Zig wrapper for the Zstandard (zstd) compression library.\n\nThis module provides idiomatic Zig bindings to the zstd C library using the C ABI (`extern \"c\"`), offering both simple one-shot functions and advanced streaming/stateful APIs.\n\n**Goal**: Build a standalone, well-documented library wrapping zstd functionality with Zig's memory safety and error handling.\n\n## Architecture\n\nThis library uses:\n\n- **C ABI interop**: Direct `extern \"c\"` function declarations to call zstd functions\n- **Static linking**: Links against `libzstd.a` built from source\n- **Zero-cost abstractions**: Thin Zig wrappers that add type safety and error handling without runtime overhead\n\n## Module content\n\n- **Stateless API**: One-shot compression and decompression functions\n- **Stateful API**: Compression contexts for reusing memory, with fine control over compression parameters and memory usage\n- **Streaming API**: Chunk-by-chunk compression for large files\n- **Dictionary support**: Better compression for small files with repeated patterns\n- **Compression recipes**: Optimized presets for different data types (text, JSON, binary)\n\n## Examples\n\nSee the tests in main.zig for comprehensive usage examples of all APIs.\n\n## Quick Start\n\n```zig\n// Simple compression\nconst compressed = try z.simple_compress(allocator, data, 3);\ndefer allocator.free(compressed);\n\n// Auto-detecting decompression\nconst decompressed = try z.simple_auto_decompress(allocator, compressed);\ndefer allocator.free(decompressed);\n```\n\n## Building\n\n### 1. Build the zstd static library\n\nThe project uses a static archive of zstd (`libzstd.a`). Build it from the vendored source:\n\n```sh\nmake\n```\n\nThis invokes the Makefile which builds `vendor/zstd/libzstd.a`.\n\n### 2. Build the Zig wrapper\n\n```sh\nzig build\n```\n\nThe `build.zig` file:\n\n1. Runs `make` to ensure `libzstd.a` exists\n2. Links the static library via C ABI\n3. Produces `libz_zstd.a` (the Zig wrapper)\n\n### 3. Run tests\n\n```sh\nzig build test\n```\n\nThis runs all tests in `src/main.zig`, demonstrating each API.\n\n## References\n\n- [Zstandard API Documentation](https://facebook.github.io/zstd/doc/api_manual_latest.html)\n- [Zstandard GitHub](https://github.com/facebook/zstd)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndrean%2Fzig-zstd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndrean%2Fzig-zstd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndrean%2Fzig-zstd/lists"}