{"id":30510817,"url":"https://github.com/zarrs/zarrs_ffi","last_synced_at":"2025-08-26T02:16:02.421Z","repository":{"id":196460354,"uuid":"696120900","full_name":"zarrs/zarrs_ffi","owner":"zarrs","description":"C/C++ bindings for the zarrs Rust crate","archived":false,"fork":false,"pushed_at":"2025-07-26T20:56:09.000Z","size":632,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-26T23:44:32.104Z","etag":null,"topics":["c","cpp","library","zarr","zarr-v3","zarrs"],"latest_commit_sha":null,"homepage":"https://zarrs.dev/zarrs_ffi/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zarrs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-09-25T06:08:26.000Z","updated_at":"2025-07-26T20:52:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f75de4f-a7ab-48b9-813e-30f771f1fd36","html_url":"https://github.com/zarrs/zarrs_ffi","commit_stats":null,"previous_names":["ldeakin/zarrs-ffi","zarrs/zarrs_ffi"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/zarrs/zarrs_ffi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarrs%2Fzarrs_ffi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarrs%2Fzarrs_ffi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarrs%2Fzarrs_ffi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarrs%2Fzarrs_ffi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zarrs","download_url":"https://codeload.github.com/zarrs/zarrs_ffi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarrs%2Fzarrs_ffi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272160241,"owners_count":24883779,"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-08-26T02:00:07.904Z","response_time":60,"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":["c","cpp","library","zarr","zarr-v3","zarrs"],"created_at":"2025-08-26T02:15:58.218Z","updated_at":"2025-08-26T02:16:02.407Z","avatar_url":"https://github.com/zarrs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zarrs_ffi\n\n[![Latest Version](https://img.shields.io/crates/v/zarrs_ffi.svg)](https://crates.io/crates/zarrs_ffi)\n[![zarrs_ffi documentation](https://img.shields.io/badge/docs-Doxygen-green)](https://zarrs.dev/zarrs_ffi/)\n[![zarrs documentation](https://img.shields.io/badge/docs-docs.rs-green)](https://docs.rs/zarrs_ffi)\n![msrv](https://img.shields.io/crates/msrv/zarrs_ffi)\n[![build](https://github.com/LDeakin/zarrs_ffi/actions/workflows/ci.yml/badge.svg)](https://github.com/LDeakin/zarrs_ffi/actions/workflows/ci.yml)\n\nC/C++ bindings for the [`zarrs`] crate, a Rust library for the [Zarr](https://zarr.dev) storage format for multidimensional arrays and metadata.\n\n`zarrs_ffi` is a single header library: `zarrs.h` [(docs)](https://zarrs.dev/zarrs_ffi/zarrs_8h.html).\n\nCurrently `zarrs_ffi` only supports a small subset of the [`zarrs`] API.\n\nA changelog can be found [here](https://github.com/LDeakin/zarrs_ffi/blob/main/CHANGELOG.md).\n\n## Example\n```C++\n#include \"zarrs.h\"\n\nvoid main() {\n  // Open a filesystem store pointing to a zarr hierarchy\n  ZarrsStorage storage = nullptr;\n  zarrs_assert(zarrsCreateStorageFilesystem(\"/path/to/hierarchy.zarr\", \u0026storage));\n\n  // Open an array in the hierarchy\n  ZarrsArray array = nullptr;\n  zarrs_assert(zarrsOpenArrayRW(storage, \"/array\", \u0026array));\n\n  // Get the array dimensionality\n  size_t dimensionality;\n  zarrs_assert(zarrsArrayGetDimensionality(array, \u0026dimensionality));\n  assert(dimensionality == 2);\n\n  // Retrieve the decoded bytes of the chunk at [0, 0]\n  size_t indices[] = {0, 0};\n  size_t chunk_size;\n  zarrs_assert(zarrsArrayGetChunkSize(array, 2, indices, \u0026chunk_size));\n  std::unique_ptr\u003cuint8_t[]\u003e chunk_bytes(new uint8_t[chunk_size]);\n  zarrs_assert(zarrsArrayRetrieveChunk(array, 2, indices, chunk_size, chunk_bytes.get()));\n}\n```\n\nSee a more comprehensive example in the [examples](https://github.com/LDeakin/zarrs_ffi/tree/main/examples) directory.\n\n## CMake Quickstart\n1. Install the Rust compiler (and cargo).\n2. Put [Findzarrs.cmake](https://github.com/LDeakin/zarrs_ffi/blob/main/examples/Findzarrs.cmake) in your `CMAKE_MODULE_PATH`\n3. `find_package(zarrs \u003cversion\u003e REQUIRED COMPONENTS zarrs/bz2)`\n   - Replace `\u003cversion\u003e` with the latest release: [![Latest Version](https://img.shields.io/crates/v/zarrs_ffi.svg)](https://crates.io/crates/zarrs_ffi) (e.g., `0.9` or `0.9.2`)\n   - [`zarrs`] is retrieved from `GitHub` using [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) and built using [corrosion](https://github.com/corrosion-rs/corrosion)\n   - Components are optional [`zarrs`] codecs\n4. the `zarrs_ffi` library is available as the `zarrs::zarrs` or  `zarrs::zarrs-static` target\n\nA complete `CMake` example can be found in [examples/](https://github.com/LDeakin/zarrs_ffi/tree/main/examples/).\n\n## Manual Build\n\n#### Basic Build\nBuilding generates a header, and a platform-dependent static and dynamic library.\n```bash\ncargo build --release --features cbindgen # -\u003e zarrs.h and target/release/[lib]zarrs_ffi{.a,.so,.dll,.dylib}\n```\n`zarrs.h` is only re-generated if the `cbindgen` feature is enabled.\n\n#### Enabling SIMD intrinsics\nEncoding and decoding performance may be improved with `avx2`/`sse2` enabled (if supported).\nCompile with either of:\n - `RUSTFLAGS=\"-C target-cpu=native\"`\n - `RUSTFLAGS=\"-C target-feature=+avx2,+sse2\"`\n\n#### Enabling non-default zarrs codecs\nNon-default `zarrs` codecs (see [`zarrs` crate features](https://docs.rs/zarrs/latest/zarrs/#crate-features)) can be enabled with the `all_codecs` feature.\nAlternatively, individual codecs can be enabled by passing them as feature flags.\nFor example:\n```bash\ncargo build --release --features cbindgen --features zarrs/zstd,zarrs/bitround,zarrs/zfp,zarrs/bz2,zarrs/pcodec,zarrs/gdeflate\n```\n\n## Licence\n`zarrs_ffi` is licensed under either of\n - the Apache License, Version 2.0 [LICENSE-APACHE](./LICENCE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e or\n - the MIT license [LICENSE-MIT](./LICENCE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e, at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[`zarrs`]: https://github.com/LDeakin/zarrs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarrs%2Fzarrs_ffi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzarrs%2Fzarrs_ffi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarrs%2Fzarrs_ffi/lists"}