{"id":42889146,"url":"https://github.com/tmaklin/bxzstr","last_synced_at":"2026-01-30T14:55:22.646Z","repository":{"id":41904298,"uuid":"223015786","full_name":"tmaklin/bxzstr","owner":"tmaklin","description":"A C++ header-only ZLib / libBZ2 / libLZMA / Zstandard wrapper.","archived":false,"fork":false,"pushed_at":"2025-02-03T09:23:30.000Z","size":155,"stargazers_count":52,"open_issues_count":11,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-03T10:26:50.737Z","etag":null,"topics":["bzip2","c-plus-plus","compression","decompression","header-only","lzma","wrapper","zlib","zstandard","zstd"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmaklin.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":"2019-11-20T19:52:59.000Z","updated_at":"2025-02-03T09:21:25.000Z","dependencies_parsed_at":"2025-02-03T10:24:00.818Z","dependency_job_id":"e763ef18-a26d-4a29-9e08-a0fd08ec286f","html_url":"https://github.com/tmaklin/bxzstr","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/tmaklin/bxzstr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaklin%2Fbxzstr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaklin%2Fbxzstr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaklin%2Fbxzstr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaklin%2Fbxzstr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmaklin","download_url":"https://codeload.github.com/tmaklin/bxzstr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmaklin%2Fbxzstr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28914895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bzip2","c-plus-plus","compression","decompression","header-only","lzma","wrapper","zlib","zstandard","zstd"],"created_at":"2026-01-30T14:55:22.563Z","updated_at":"2026-01-30T14:55:22.635Z","avatar_url":"https://github.com/tmaklin.png","language":"C++","readme":"# bxzstr — A C++11 ZLib / libBZ2 / libLZMA / libZstd wrapper\n\nHeader-only library for using standard c++ iostreams to access streams\ncompressed with ZLib, libBZ2, libLZMA, or libZstd (.gz, .bz2, .xz, and\n.zst files).\n\nFor decompression, the format is automatically detected. For\ncompression, the only parameter exposed is the compression algorithm.\n\nbxzstr is a fork of the [zstr](https://github.com/mateidavid/zstr)\nlibrary by [Matei David](https://github.com/mateidavid), and the core\nfunctionality of this library remains largely the same.\n\n## Input detection\n\nThe library automatically detects whether the input stream is\ncompressed or not, and with which algorithm. The detection is based on\nidentifying the headers based on the magic numbers:\n* GZip header, starting with **1F 8B**\n* ZLib header, starting with **78 01**, **78 9c**, and **78 DA**\n* BZ2 header, starting with **42 5a 68**\n* LZMA header, starting with **FD 37 7A 58 5A 00**\n* ZSTD header, starting with **28 B5 2F FD**\n\nwhen no header is identified, the stream is treated as plain text (uncompressed).\n\n## Usage\nThe streams can be accessed through 6 classes that function similarly\nto their standard library counterparts\n\n* `bxz::istreambuf` is the core decompression class.\n* `bxz::ostreambuf` is the core compression class.\n* `bxz::istream` is a wrapper for the `bxz::istreambuf` class.\n* `bxz::ostream` is a wrapper for the `bxz::ostreambuf` class.\n* `bxz::ifstream` is a wrapper for the `bxz::istreambuf` class that\n  can be used to open a file and read decompressed data from it.\n* `bxz::ofstream` is a wrapper for the `bxz::ostreambuf` class that\n  can be used to write compressed data to a file.\n\nFor the classes derived from `bxz::ostreambuf`, the compression\nalgorithm must be specified as the second argument:\n```\nbxz::ofstream(\"filename\", bxz::z);\nbxz::ostream(std::cin, bxz::bz2);\nbxz::ostreambuf(std::cin.rdbuf(), bxz::lzma);\n```\n\nIt's also possible to specify the compression level (1-9) as the third\nparameter (default level is 6):\n```\nbxz::ofstream(\"filename\", bxz::z, 1);\nbxz::ostream(std::cin, bxz::bz2, 5);\nbxz::ostreambuf(std::cin.rdbuf(), bxz::lzma, 9);\n```\n\nIf the stream objects fail at any point, `failbit` exception mask will\nbe turned on.\n\n## Configuration\nYou can use the library without one of libz, libbz2, or liblzma by\nmodifying the `config.hpp` file. For example, to disable lzma support,\nset BXZSTR_LZMA_SUPPORT to 0:\n```\n#ifndef BXZSTR_CONFIG_HPP\n#define BXZSTR_CONFIG_HPP\n\n#define BXZSTR_Z_SUPPORT 1\n#define BXZSTR_BZ2_SUPPORT 1\n#define BXZSTR_LZMA_SUPPORT 0\n#define BXZSTR_ZSTD_SUPPORT 0\n\n#endif\n```\nThe rest of the project will adapt accordingly.\n\n## Automatic configuration\nIt is also possible to configure the header automatically with CMake,\ne. g. as part of a larger project, by running\n```\ncmake .\n```\nin the root directory. CMake will modify `config.hpp` to match the\nlibraries supported on the system. If the\n[find_package](https://cmake.org/cmake/help/v3.0/command/find_package.html)\ncommand has already been run in CMake, automatic configuration will\nrespect the results instead of running find_package again.\n\n## Testing\nbxzstr implements (non-exhaustive) testing for parts of the source\ncode using the [googletest](https://github.com/google/googletest)\nframework. For more details, see the documentation at\n[docs/development/building_tests.md](/docs/development/building_tests.md).\n\n## Requirements and dependencies\n* Compiler with c++11 support\n* CMake v3.0 or greater (for automatic config)\n* libz, libbz2, liblzma, and/or libzstd\n\n## License\nThe source code from this project is subject to the terms of the\nMozilla Public License, v. 2.0. A copy of the MPL is supplied with the\nproject, or can be obtained at\n[https://mozilla.org/MPL/2.0/](https://mozilla.org/MPL/2.0/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmaklin%2Fbxzstr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmaklin%2Fbxzstr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmaklin%2Fbxzstr/lists"}