{"id":18900014,"url":"https://github.com/likema/zstd-hook","last_synced_at":"2025-10-17T06:53:59.325Z","repository":{"id":143436678,"uuid":"547894829","full_name":"likema/zstd-hook","owner":"likema","description":"Hook zstd for setting compression level and compression threads","archived":false,"fork":false,"pushed_at":"2022-10-08T14:22:32.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-31T09:23:53.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/likema.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":"2022-10-08T14:08:25.000Z","updated_at":"2022-10-08T14:13:25.000Z","dependencies_parsed_at":"2023-06-06T18:45:22.666Z","dependency_job_id":null,"html_url":"https://github.com/likema/zstd-hook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likema%2Fzstd-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likema%2Fzstd-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likema%2Fzstd-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likema%2Fzstd-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/likema","download_url":"https://codeload.github.com/likema/zstd-hook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239879460,"owners_count":19712218,"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":[],"created_at":"2024-11-08T08:48:47.083Z","updated_at":"2025-10-17T06:53:59.244Z","avatar_url":"https://github.com/likema.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hook zstd for setting compression level and compression threads\n\nA shared library to hook `ZSTD_CCtx* ZSTD_createCCtx(void)` for setting compression level and compression threads.\n\nFor `qemu-img` (\u003e= **6.0**) or the similar programs without setting zstd compression level and compression threads options.\n\nSee also: [How to change zstd level for qcow2 image?](https://stackoverflow.com/questions/72562226/how-to-change-zstd-level-for-qcow2-image)\n\n## Building\n\n```shell\ncd zstd-hook\ncmake -DCMAKE_BUILD_TYPE=Release\nmake\n```\n\n## Usage\n\nSet the following environment variables:\n\n* `ZSTD_CLEVEL` : the zstd compression level between `1` and `22`\n* `ZSTD_NBTHREADS` : the zstd compression threads\n* `LD_PRELOAD` : the hook library `libzstdhook.so`\n* `LD_LIBRARY_PATH` : the directory for the hook library `libzstdhook.so`\n\nFor examples, hook `qemu-img` (\u003e= **6.0**) converting source image to zstd compressed `qcow2` image by compression level `22` and the **maximum** compression threads on Ubuntu 22.04:\n\n```shell\ncd zstd-hook\nLD_LIBRARY_PATH=. LD_PRELOAD=libzstdhook.so \\\n  ZSTD_CLEVEL=22 ZSTD_NBTHREADS=`grep -c '^processor' /proc/cpuinfo` \\\n  qemu-img convert -c -o compression_type=zstd -O qcow2 \u003corigin-image\u003e \u003ccompressed-qcow2\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikema%2Fzstd-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flikema%2Fzstd-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikema%2Fzstd-hook/lists"}