{"id":27214874,"url":"https://github.com/rikyoz/bit7z","last_synced_at":"2026-02-24T23:06:01.030Z","repository":{"id":24593739,"uuid":"28002069","full_name":"rikyoz/bit7z","owner":"rikyoz","description":"A C++ static library offering a clean and simple interface to the 7-zip shared libraries.","archived":false,"fork":false,"pushed_at":"2026-02-22T18:18:37.000Z","size":6719,"stargazers_count":810,"open_issues_count":66,"forks_count":140,"subscribers_count":18,"default_branch":"master","last_synced_at":"2026-02-22T23:02:58.605Z","etag":null,"topics":["7-zip","7z","7zip","archives","archives-metadata","bzip2","c-plus-plus","compression","cpp","cpp-library","cross-platform","encrypted-archives","extraction","gzip","in-memory","multi-volume-archives","rar","static-library","tar","zip"],"latest_commit_sha":null,"homepage":"https://rikyoz.github.io/bit7z","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/rikyoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"rikyoz","patreon":null,"open_collective":null,"ko_fi":"rikyoz","tidelift":null}},"created_at":"2014-12-14T17:36:56.000Z","updated_at":"2026-02-22T14:11:24.000Z","dependencies_parsed_at":"2026-01-18T13:09:30.812Z","dependency_job_id":null,"html_url":"https://github.com/rikyoz/bit7z","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/rikyoz/bit7z","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikyoz%2Fbit7z","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikyoz%2Fbit7z/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikyoz%2Fbit7z/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikyoz%2Fbit7z/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rikyoz","download_url":"https://codeload.github.com/rikyoz/bit7z/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rikyoz%2Fbit7z/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29804246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T22:43:48.403Z","status":"ssl_error","status_checked_at":"2026-02-24T22:43:18.536Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["7-zip","7z","7zip","archives","archives-metadata","bzip2","c-plus-plus","compression","cpp","cpp-library","cross-platform","encrypted-archives","extraction","gzip","in-memory","multi-volume-archives","rar","static-library","tar","zip"],"created_at":"2025-04-10T04:01:10.215Z","updated_at":"2026-02-24T23:06:01.006Z","avatar_url":"https://github.com/rikyoz.png","language":"C++","readme":"\u003ch1 align=\"center\"\u003ebit7z\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eA C++ static library offering a clean and simple interface to the 7-Zip shared libraries.\u003c/h3\u003e\n\n\u003c!-- navbar --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#-supported-features\" title=\"List of Features Supported by the Library\"\u003eSupported Features\u003c/a\u003e •\n  \u003ca href=\"#-getting-started-library-usage\" title=\"Basic Source Code Examples\"\u003eGetting Started\u003c/a\u003e •\n  \u003ca href=\"#-download\" title=\"Download Pre-compiled Packages\"\u003eDownload\u003c/a\u003e •\n  \u003ca href=\"#-requirements\" title=\"Usage Requirements\"\u003eRequirements\u003c/a\u003e •\n  \u003ca href=\"#-installation\" title=\"Installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#%EF%B8%8F-configuration\" title=\"Configuration\"\u003eConfiguration\u003c/a\u003e •\n  \u003ca href=\"#-donate\" title=\"Support the Project\"\u003eDonate\u003c/a\u003e •\n  \u003ca href=\"#-license\" title=\"Project License\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c!-- navbar --\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/rikyoz/bit7z/releases\" title=\"Latest Stable GitHub Release\"\u003e\u003cimg src=\"https://img.shields.io/github/release/rikyoz/bit7z/all.svg?style=flat\u0026logo=github\u0026logoColor=white\u0026colorB=blue\u0026label=\" alt=\"GitHub release\"\u003e\u003c/a\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/-C++14-3F63B3.svg?style=flat\u0026logo=C%2B%2B\u0026logoColor=white\" alt=\"C++14\" title=\"C++ Standards Used: C++14\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/-Windows-6E46A2.svg?style=flat\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0ODc1IDQ4NzUiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0wIDBoMjMxMXYyMzEwSDB6bTI1NjQgMGgyMzExdjIzMTBIMjU2NHpNMCAyNTY0aDIzMTF2MjMxMUgwem0yNTY0IDBoMjMxMXYyMzExSDI1NjQiLz48L3N2Zz4=\u0026logoColor=white\" alt=\"Windows\" title=\"Supported Platform: Windows\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/-Linux-ad3a90.svg?style=flat\u0026logo=linux\u0026logoColor=white\" alt=\"Linux\" title=\"Supported Platform: Linux\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/-macOS-d43d6c.svg?style=flat\u0026logo=apple\u0026logoColor=white\" alt=\"macOS\" title=\"Supported Platform: macOS\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/-BSD-red.svg?style=flat\u0026logo=freebsd\u0026logoColor=white\" alt=\"BSD\" title=\"Supported Platform: BSD\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/-x86%20\u0026middot;%20x64%20\u0026middot;%20arm%20\u0026middot;%20arm64-orange.svg?style=flat\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHZpZXdCb3g9IjAgMCA5NDIgOTQyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNTc5LjEgODk0YTQ4IDQ4IDAgMCAwIDk2IDB2LTc3LjVoLTk1LjlWODk0aC0uMXpNNTc5LjEgNDh2NzcuNUg2NzVWNDhhNDggNDggMCAwIDAtOTUuOSAwek00MjMgNDh2NzcuNWg5NlY0OGE0OCA0OCAwIDAgMC05NiAwek00MjMgODk0YTQ4IDQ4IDAgMCAwIDk2IDB2LTc3LjVoLTk2Vjg5NHpNMjY3IDQ4djc3LjVoOTUuOVY0OGE0OCA0OCAwIDAgMC05NS45IDB6TTI2NyA4OTRhNDggNDggMCAwIDAgOTYgMHYtNzcuNWgtOTZWODk0ek0wIDYyN2E0OCA0OCAwIDAgMCA0OCA0OGg3Ny41di05NS45SDQ4QTQ4IDQ4IDAgMCAwIDAgNjI3ek04OTQgNTc5LjFoLTc3LjVWNjc1SDg5NGE0OCA0OCAwIDAgMCAwLTk1Ljl6TTAgNDcxYTQ4IDQ4IDAgMCAwIDQ4IDQ4aDc3LjV2LTk2SDQ4YTQ4IDQ4IDAgMCAwLTQ4IDQ4ek04OTQgNDIzaC03Ny41djk2SDg5NGE0OCA0OCAwIDAgMCAwLTk2ek0wIDMxNWE0OCA0OCAwIDAgMCA0OCA0OGg3Ny41di05Nkg0OGE0OCA0OCAwIDAgMC00OCA0OHpNODk0IDI2N2gtNzcuNXY5NS45SDg5NGE0OCA0OCAwIDAgMCAwLTk1Ljl6TTE3MS42IDcyMC40YTUwIDUwIDAgMCAwIDUwIDUwaDQ5OC44YTUwIDUwIDAgMCAwIDUwLTUwVjIyMS42YTUwIDUwIDAgMCAwLTUwLTUwSDIyMS42YTUwIDUwIDAgMCAwLTUwIDUwdjQ5OC44eiIvPjwvc3ZnPg==\" alt=\"x86, x64, arm, arm64\" title=\"Supported CPU Architectures: x86, x64, arm, arm64\"\u003e\u0026thinsp;\u003ca href=\"#%EF%B8%8F-donate\" title=\"Donate\"\u003e\u003cimg src=\"https://img.shields.io/badge/-donate-yellow.svg?style=flat\u0026logo=paypal\u0026logoColor=white\" alt=\"donate\"\u003e\u003c/a\u003e\u0026thinsp;\u003ca href=\"https://github.com/rikyoz/bit7z/wiki\" title=\"Project Documentation\"\u003e\u003cimg src=\"https://img.shields.io/badge/-docs-green.svg?style=flat\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGRhdGEtbmFtZT0iTGF5ZXIgMSIgdmlld0JveD0iMCAwIDEwNS4zIDEyMi45Ij48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiIGQ9Ik0xNy41IDBIMTAydjk0LjJjLS4xIDIuNy0zLjUgMi43LTcuMiAyLjZIMTYuM2E5LjIgOS4yIDAgMCAwIDAgMTguNEg5OHYtOS44aDcuMlYxMThhNC4yIDQuMiAwIDAgMS00LjEgNC4xSDE2LjZDNy41IDEyNS41IDAgMTE4IDAgMTA4LjhWMTcuNUExNy42IDE3LjYgMCAwIDEgMTcuNSAwWm0tMS4zIDEwOGg3NS4yYTEuNCAxLjQgMCAwIDEgMS40IDEuM3YuOGExLjQgMS40IDAgMCAxLTEuNCAxLjRIMTYuMmExLjQgMS40IDAgMCAxLTEuMy0xLjR2LS44YTEuNCAxLjQgMCAwIDEgMS4zLTEuNFptMC03LjJoNzUuMmExLjQgMS40IDAgMCAxIDEuNCAxLjR2LjhhMS40IDEuNCAwIDAgMS0xLjQgMS40SDE2LjJBMS40IDEuNCAwIDAgMSAxNSAxMDN2LS44YTEuNCAxLjQgMCAwIDEgMS4zLTEuNFoiLz48L3N2Zz4=\" alt=\"docs\"\u003e\u003c/a\u003e\u0026thinsp;\u003ca href=\"https://ci.appveyor.com/project/rikyoz/bit7z\" title=\"AppVeyor CI Build Status\"\u003e\u003cimg src=\"https://img.shields.io/appveyor/ci/rikyoz/bit7z.svg?style=flat\u0026logo=appveyor\u0026logoColor=white\u0026label=\" alt=\"Build status\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  \u003cimg src=\"https://img.shields.io/badge/MSVC%202015+-flag.svg?color=555555\u0026style=flat\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iI2ZmZiIgZD0ibTIxIDQtNC0yYTEgMSAwIDAgMC0xIDBsLTggOC00LTNhMSAxIDAgMCAwLTEgMEwyIDhhMSAxIDAgMCAwIDAgMWwzIDMtMyAzYTEgMSAwIDAgMCAwIDFsMSAxYTEgMSAwIDAgMCAxIDBsNC0zIDggOGExIDEgMCAwIDAgMSAwbDQtMmExIDEgMCAwIDAgMS0xVjVhMSAxIDAgMCAwLTEtMXptLTQgMTItNi00IDYtNXoiLz48L3N2Zz4=\u0026logoColor=white\" alt=\"MSVC 2015+\" title=\"Supported Windows Compiler: MSVC 2015 or later\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/MinGW%206.4+%20-flag.svg?color=555555\u0026style=flat\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMzIgMTMyIj48cGF0aCBmaWxsPSIjY2NjIiBkPSJtMCA1MiAyMy0yNCAyNCAyNC0yNCAyM3ptMCA1OCAyMy0yNCAyNCAyNC0yNCAyM3oiLz48cGF0aCBmaWxsPSIjN2Q3ZDdkIiBkPSJtMjkgODEgMjMtMjQgMjQgMjQtMjQgMjN6bS0xLTU4TDUyIDBsMjMgMjMtMjMgMjR6Ii8+PHBhdGggZmlsbD0iI2NjYyIgZD0ibTU3IDUyIDI0LTIzIDIzIDIzLTIzIDI0eiIvPjxwYXRoIGZpbGw9IiM3ZDdkN2QiIGQ9Im04NiAyMyAyNC0yMyAyMyAyMy0yMyAyNHoiLz48cGF0aCBmaWxsPSIjY2NjIiBkPSJtNTcgMTA5IDI0LTIzIDIzIDIzLTIzIDIzeiIvPjxwYXRoIGZpbGw9IiM3ZDdkN2QiIGQ9Im04NiA4MSAyMy0yNCAyMyAyNC0yMyAyM3oiLz48L3N2Zz4=\u0026logoColor=white\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/GCC%204.9+-flag.svg?color=555555\u0026style=flat\u0026logo=gnu\u0026logoColor=white\" alt=\"GCC 4.9+\" title=\"Supported Unix Compiler: GCC 4.9 or later\"\u003e\u0026thinsp;\u003cimg src=\"https://img.shields.io/badge/Clang%203.6+-flag.svg?color=555555\u0026style=flat\u0026logo=llvm\u0026logoColor=white\" alt=\"Clang 3.6+\" title=\"Supported Unix Compiler: Clang 3.5 or later\"\u003e\u0026thinsp;\u003ca href=\"https://www.codefactor.io/repository/github/rikyoz/bit7z\" alt=\"Codefactor Grade\"\u003e\u003cimg alt=\"CodeFactor Grade\" src=\"https://img.shields.io/codefactor/grade/github/rikyoz/bit7z?label=Code%20Quality\u0026logo=codefactor\u0026logoColor=white\"\u003e\u003c/a\u003e\u0026thinsp;\u003ca href=\"https://github.com/rikyoz/bit7z/blob/master/LICENSE\" title=\"Project License: MPLv2\"\u003e\u003cimg src=\"https://img.shields.io/badge/-MPL--2.0-lightgrey.svg?style=flat\u0026logo=mozilla\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\n## ⚡️ Introduction\n\n**bit7z** is a _cross-platform_ C++ static library that allows the _compression/extraction of archive files_ through a _clean_ and _simple_ wrapper interface to the dynamic libraries from the [7-Zip](https://www.7-zip.org/ \"7-Zip Project Homepage\") project.\u003cbr/\u003e\nIt supports compression and extraction to and from the filesystem or the memory, reading archives metadata, updating existing ones, creating multi-volume archives, operation progress callbacks, and many other functionalities.\n\n## 🎯 Supported Features\n\n+ **Compression** using the following archive formats: **7z**, XZ, **BZIP2**, **GZIP**, TAR, **ZIP**, and WIM.\n+ **Extraction** of many archive formats: **7z**, AR, ARJ, **BZIP2**, CAB, CHM, CPIO, CramFS, DEB, DMG, EXT, FAT, GPT, **GZIP**, HFS, HXS, IHEX, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, QCOW2, **RAR**, **RAR5**, RPM, SquashFS, TAR, UDF, UEFI, VDI, VHD, VMDK, WIM, XAR, XZ, Z, and **ZIP**.\n+ **Reading metadata** of archives and their content.\n+ **Testing** archives for errors.\n+ **Updating** existing file archives with new files.\n+ **Renaming**, **updating**, or **deleting** old items in existing file archives.\n+ **Compression and extraction _to and from_ memory** and **C++ standard streams**.\n+ Compression using **custom path aliases** for the items in the output archives.\n+ **Selective extraction** of only specified files/folders **using wildcards** and **regular expressions**.\n+ Creation of **encrypted archives** (strong AES-256 encryption; only for 7z and ZIP formats).\n+ **Archive header encryption** (only for 7z format).\n+ Possibility to choose the **compression level** (if supported by the archive format), the **compression method** ([supported methods](https://github.com/rikyoz/bit7z/wiki/Advanced-Usage#compression-methods \"Wiki page on bit7z's supported compression methods\")), the **dictionary size**, and the **word size**.\n+ **Automatic input archive format detection**.\n+ **Solid archives** (only for 7z).\n+ **Multi-volume archives**.\n+ **Operation callbacks** for obtaining real-time information about ongoing operations.\n+ **Canceling** or **pausing** the current operation.\n\n\u003e [!NOTE]\n\u003e\n\u003e The presence or not of some of the above features depends on the specific 7-Zip shared library used. \n\u003e\n\u003e For example, 7z.dll should support all these features, 7za.dll should work only with the 7z file format, and 7zxa.dll can only extract 7z files.\n\u003e\n\u003e For more information about the 7-Zip DLLs, please check this [wiki page](https://github.com/rikyoz/bit7z/wiki/7z-DLLs).\n\n\u003e [!NOTE]\n\u003e\n\u003e Some features (e.g., _automatic format detection_ and _selective extraction using regular expressions_) are disabled by default, and macro definitions must be used during compilation to have them available ([wiki](https://github.com/rikyoz/bit7z/wiki/Building-the-library)).\n\n## 🔥 Getting Started (Library Usage)\n\nBelow are a few examples that show how to use some of the main features of bit7z.\n\n### 📂 Extracting Files from an Archive\n\n```cpp\n#include \u003cbit7z/bitfileextractor.hpp\u003e\n\ntry { // bit7z classes can throw BitException objects\n    using namespace bit7z;\n\n    Bit7zLibrary lib{ \"7za.dll\" };\n    BitFileExtractor extractor{ lib, BitFormat::SevenZip };\n\n    // Extracting a simple archive\n    extractor.extract( \"path/to/archive.7z\", \"out/dir/\" );\n\n    // Extracting a specific file inside an archive\n    extractor.extractMatching( \"path/to/archive.7z\", \"file.pdf\", \"out/dir/\" );\n\n    // Extracting the first file of an archive to a buffer\n    std::vector\u003c byte_t \u003e buffer;\n    extractor.extract( \"path/to/archive.7z\", buffer );\n\n    // Extracting an encrypted archive\n    extractor.setPassword( \"password\" );\n    extractor.extract( \"path/to/another/archive.7z\", \"out/dir/\" );\n} catch ( const bit7z::BitException\u0026 ex ) { /* Do something with ex.what()...*/ }\n```\n\nAlternatively, if you only need to work on a single archive:\n\n```cpp\n#include \u003cbit7z/bitarchivereader.hpp\u003e\n\ntry { // bit7z classes can throw BitException objects\n    using namespace bit7z;\n\n    Bit7zLibrary lib{ \"7z.dll\" };\n\n    // Opening the archive\n    BitArchiveReader archive{ lib, \"path/to/archive.gz\", BitFormat::GZip };\n\n    // Testing the archive\n    archive.test();\n\n    // Extracting the archive\n    archive.extractTo( \"out/dir/\" );\n} catch ( const bit7z::BitException\u0026 ex ) { /* Do something with ex.what()...*/ }\n```\n\n### 💼 Compressing Files into an Archive\n\n```cpp\n#include \u003cbit7z/bitfilecompressor.hpp\u003e\n\ntry { // bit7z classes can throw BitException objects\n    using namespace bit7z;\n\n    Bit7zLibrary lib{ \"7z.dll\" };\n    BitFileCompressor compressor{ lib, BitFormat::Zip };\n\n    std::vector\u003c std::string \u003e files = { \"path/to/file1.jpg\", \"path/to/file2.pdf\" };\n\n    // Creating a simple zip archive\n    compressor.compress( files, \"output_archive.zip\" );\n\n    // Creating a zip archive with a custom directory structure\n    std::map\u003c std::string, std::string \u003e files_map = {\n        { \"path/to/file1.jpg\", \"alias/path/file1.jpg\" },\n        { \"path/to/file2.pdf\", \"alias/path/file2.pdf\" }\n    };\n    compressor.compress( files_map, \"output_archive2.zip\" );\n\n    // Compressing a directory\n    compressor.compressDirectory( \"dir/path/\", \"dir_archive.zip\" );\n\n    // Creating an encrypted zip archive of two files\n    compressor.setPassword( \"password\" );\n    compressor.compressFiles( files, \"protected_archive.zip\" );\n\n    // Updating an existing zip archive\n    compressor.setUpdateMode( UpdateMode::Append );\n    compressor.compressFiles( files, \"existing_archive.zip\" );\n\n    // Compressing a single file into a buffer\n    std::vector\u003c bit7z::byte_t \u003e buffer;\n    BitFileCompressor compressor2{ lib, BitFormat::BZip2 };\n    compressor2.compressFile( files[0], buffer );\n} catch ( const bit7z::BitException\u0026 ex ) { /* Do something with ex.what()...*/ }\n```\n\nAlternatively, if you only need to work on a single archive:\n\n```cpp\n#include \u003cbit7z/bitarchivewriter.hpp\u003e\n\ntry { // bit7z classes can throw BitException objects\n    using namespace bit7z;\n\n    Bit7zLibrary lib{ \"7z.dll\" };\n    BitArchiveWriter archive{ lib, BitFormat::SevenZip };\n\n    // Adding the items to be compressed (no compression is performed here)\n    archive.addFile( \"path/to/file.txt\" );\n    archive.addDirectory( \"path/to/dir/\" );\n\n    // Compressing the added items to the output archive\n    archive.compressTo( \"output.7z\" );\n} catch ( const bit7z::BitException\u0026 ex ) { /* Do something with ex.what()...*/ }\n```\n\n### 📑 Reading Archive Metadata\n\n```cpp\n#include \u003cbit7z/bitarchivereader.hpp\u003e\n\ntry { // bit7z classes can throw BitException objects\n    using namespace bit7z;\n\n    Bit7zLibrary lib{ \"7za.dll\" };\n    BitArchiveReader arc{ lib, \"archive.7z\", BitFormat::SevenZip };\n\n    // Printing archive metadata\n    std::cout \u003c\u003c \"Archive properties\\n\";\n    std::cout \u003c\u003c \"  Items count: \"   \u003c\u003c arc.itemsCount() \u003c\u003c '\\n';\n    std::cout \u003c\u003c \"  Folders count: \" \u003c\u003c arc.foldersCount() \u003c\u003c '\\n';\n    std::cout \u003c\u003c \"  Files count: \"   \u003c\u003c arc.filesCount() \u003c\u003c '\\n';\n    std::cout \u003c\u003c \"  Size: \"          \u003c\u003c arc.size() \u003c\u003c'\\n';\n    std::cout \u003c\u003c \"  Packed size: \"   \u003c\u003c arc.packSize() \u003c\u003c \"\\n\\n\";\n\n    // Printing the metadata of the archived items\n    std::cout \u003c\u003c \"Archived items\";\n    for ( const auto\u0026 item : arc ) {\n        std::cout \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"  Item index: \"    \u003c\u003c item.index() \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"    Name: \"        \u003c\u003c item.name() \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"    Extension: \"   \u003c\u003c item.extension() \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"    Path: \"        \u003c\u003c item.path() \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"    IsDir: \"       \u003c\u003c item.isDir() \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"    Size: \"        \u003c\u003c item.size() \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"    Packed size: \" \u003c\u003c item.packSize() \u003c\u003c '\\n';\n        std::cout \u003c\u003c \"    CRC: \" \u003c\u003c std::hex \u003c\u003c item.crc() \u003c\u003c std::dec \u003c\u003c '\\n';\n    }\n    std::cout.flush();\n} catch ( const bit7z::BitException\u0026 ex ) { /* Do something with ex.what()...*/ }\n```\n\nA complete _**API reference**_ is available in the [wiki](https://github.com/rikyoz/bit7z/wiki/) section.\n\n### 🚀 Upgrading from bit7z v3 to v4\n\nThe newest bit7z v4 introduced some significant breaking changes to the library's API.\n\n\u003cdetails\u003e\n  \u003csummary\u003eExpand for more details!\u003c/summary\u003e\n\n+ By default, the project now follows the [UTF-8 Everywhere Manifesto](http://utf8everywhere.org/):\n  + The default string type is `std::string` (instead of `std::wstring`), so users can use the library in cross-platform projects more easily (v4 introduced Linux/macOS support too).\n  + Input `std::string`s will be considered as UTF-8 encoded.\n  + You can still achieve the old behavior on Windows using the `-DBIT7Z_USE_NATIVE_STRING` CMake option.\n+ The old `BitExtractor` class is now called `BitFileExtractor`.\n  + Now `BitExtractor` is just the name of a template class for all the extraction classes.\n+ The old `BitCompressor` class is now called `BitFileCompressor`.\n  + Now `BitCompressor` is just the name of a template class for all the compression classes.\n+ The old `BitArchiveInfo` class is now called `BitArchiveReader`, and it allows to extract single archives.\n+ The `ProgressCallback` now must return a `bool` value indicating whether the current operation can continue (`true`) or not (`false`).\n+ The `BitException` class now inherits from `std::system_error` rather than `std::runtime_error`.\n\n  + The method `BitException::getErrorCode()` was renamed `BitException::hresultCode()`.\n+ The project structure changed:\n  + Public API headers moved from `include/` to the `include/bit7z/` folder, so `#include` directives now need to prepend `bit7z/` to the included header name (e.g., `#include \u003cbit7z/bitfileextractor.hpp\u003e`).\n    + Even though it is a bit verbose, it is a typical structure for C and C++ libraries, and it makes explicit which third-party library a header file belongs to.\n  + By default, the output folder of bit7z is now `lib/\u003carchitecture\u003e/`; if the CMake generator is multi-config (e.g., Visual Studio generators), the default output folder is `lib/\u003carchitecture\u003e/\u003cbuild type\u003e/`.\n    + Optionally, you can force using the \"Visual Studio style\" output path by enabling the `BIT7Z_VS_LIBNAME_OUTDIR_STYLE` CMake option.\n  + Third-party dependencies are no longer handled using git submodules but are automatically downloaded using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) when configuring/using the library via CMake.\n\n\u003c/details\u003e\n\n## 💾 Download\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://github.com/rikyoz/bit7z/releases\"\u003e\u003cimg alt=\"GitHub Latest Release\" src=\"https://img.shields.io/github/v/release/rikyoz/bit7z?sort=semver\u0026label=Latest%20Release\u0026style=social\" height='36' style='border:0;height:36px;'/\u003e\u003c/a\u003e\n\u003cbr/\u003e\n\u003ca href=\"https://github.com/rikyoz/bit7z/releases\"\u003e\n\u003cimg alt=\"GitHub All Releases\" src=\"https://img.shields.io/github/downloads/rikyoz/bit7z/total.svg?style=popout\u0026label=Total%20Downloads\u0026logo=icloud\u0026logoColor=white\"/\u003e\u003c/a\u003e\n\u003c/div\u003e\n\nEach released package contains:\n\n+ A _pre-compiled version_ of bit7z (both in _debug_ and _release_ mode);\n+ The _public API headers_ needed to use the library in your program;\n\nPackages are available for both _x86_ and _x64_ architectures.\n\nYou can also clone/download this repository and build the library yourself (please, read the [wiki](https://github.com/rikyoz/bit7z/wiki/Building-the-library)).\n\n## 🧰 Requirements\n\n+ **Operating System:** Windows, Linux, macOS, Android.\n+ **Architecture:** x86, x86_64, arm, arm64.\n+ **Language Standard:** C++11 (for using the library), C++14 (for building the library).\n+ **Compiler:** MSVC 2015 or later[^1], MinGW v6.4 or later, GCC v4.9 or later, Clang 3.6 or later.\n+ **Shared Library:** a 7-Zip `.dll` library on Windows, a 7-Zip/p7zip `.so` library on Unix.\n\n\u003e [!NOTE]\n\u003e\n\u003e + **RAR Archive Support:** The library supports RAR archives *only* when using 7-Zip's `7z.dll`/`7z.so`. It doesn't support p7zip's unrar plugin. For RAR extraction on Unix-based systems, you need to build the 7-Zip `7z.so` library.\n\u003e + **7-Zip Libraries:** Bit7z does **not** ship with the 7-Zip shared libraries. You can download the precompiled binaries or build them from the source at [7-zip.org](https://www.7-zip.org/).\n\n[^1]: MSVC 2010 was supported until v2.x, MSVC 2012/2013 until v3.x.\n\n## 🔗 Installation\n\nThe library can be installed as a dependency of your project in a number of different ways:\n\n### Using CMake's `add_subdirectory`\n\nYou can directly integrate the library into your CMake project:\n\n+ Either download bit7z's sources to a sub-directory of your project (e.g., `third_party`), or add this repository as a git submodule of yours.\n+ Then, use the command `add_subdirectory()` in your `CMakeLists.txt` to include bit7z.\n+ Finally, link the `bit7z` library using the `target_link_libraries()` command.\n\nFor example:\n\n```cmake\nadd_subdirectory(${CMAKE_SOURCE_DIR}/third_party/bit7z) # Path to bit7z's repository\n# Here you can enable/disable bit7z's build options, e.g.:\n# set(BIT7Z_USE_NATIVE_STRING ON CACHE BOOL \"enable using native OS strings\" FORCE)\ntarget_link_libraries(${YOUR_TARGET} PRIVATE bit7z)\n```\n\n### Using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake)\n\n```cmake\nCPMAddPackage(\"gh:rikyoz/bit7z@\u003cversion\u003e\") # Replace \u003cversion\u003e with the desired one.\n# Here you can enable/disable bit7z's build options, e.g.:\n# set(BIT7Z_AUTO_FORMAT ON CACHE BOOL \"enable auto format support\" FORCE)\ntarget_link_libraries(${YOUR_TARGET} PRIVATE bit7z)\n```\n\n### Using [vcpkg](https://vcpkg.io/en/)\n\nFirst, you need to install the library:\n\n```cmd\nvcpkg install bit7z\n```\n\nThen, you add bit7z as a dependency in your project's `CMakeLists.txt`:\n\n```cmake\nfind_package(unofficial-bit7z CONFIG REQUIRED)\ntarget_link_libraries(${YOUR_TARGET} PRIVATE unofficial::bit7z::bit7z64)\n```\n\n### Building from source and manually linking\n\nThe wiki provides instructions on how to [build](https://github.com/rikyoz/bit7z/wiki/Building-the-library) the library from the source code and [manually link](https://github.com/rikyoz/bit7z/wiki/Installing-the-library#manually-linking) it into your project.\n\n## 🛠️ Configuration\n\nThe library is highly customizable: for a detailed list of the available build options, please refer to the [wiki](https://github.com/rikyoz/bit7z/wiki/Build-options).\n\n### 📌 7-Zip Version\n\nWhile configuring bit7z via CMake, it automatically downloads the latest version of 7-Zip supported by the library.\n\nOptionally, you can specify a different version of 7-Zip via the CMake option `BIT7Z_7ZIP_VERSION` (e.g., `-DBIT7Z_7ZIP_VERSION=\"22.01\"`).\n\nAlternatively, you can specify a custom path containing the 7-Zip source code via the option `BIT7Z_CUSTOM_7ZIP_PATH`.\n\n\u003e [!NOTE]\n\u003e\n\u003e In general, it is best to use the same version of 7-Zip of the shared libraries that you will use at runtime.\n\u003e\n\n#### Using 7-Zip v23.01 on Linux and macOS\n\nBy default, bit7z is compatible with the `7z.so` from 7-Zip v23.01 and later.\n\nIf you plan to use the `7z.so` from p7zip or 7-Zip v22.01 and earlier instead, you have two ways to make bit7z compatible:\n\n+ Configure bit7z with the CMake option `-DBIT7Z_USE_LEGACY_IUNKNOWN=ON`; _or_\n+ Configure bit7z for 7-Zip v22.01 (i.e., `-DBIT7Z_7ZIP_VERSION=\"22.01\"`).\n\n\u003cdetails\u003e\n  \u003csummary\u003eExpand for more details\u003c/summary\u003e\n_On Linux and macOS_, 7-Zip v23.01 introduced breaking changes to the IUnknown interface.\nAs a result, if you build bit7z for such a version of 7-Zip (the default), it will not support using the shared libraries from previous versions of 7-Zip (or from p7zip).\nConversely, bit7z made for earlier versions of 7-Zip or for p7zip is incompatible with the shared libraries from 7-Zip v23.01 and later.\n\nYou can build the shared libraries of 7-Zip v23.01 in a backward-compatible mode by defining the macro `Z7_USE_VIRTUAL_DESTRUCTOR_IN_IUNKNOWN`.\nIf this is your case, you'll need to enable the `BIT7Z_USE_LEGACY_IUNKNOWN` to make bit7z work (in this case, bit7z will be compatible also with previous versions of 7-Zip/p7zip).\n\n\u003c/details\u003e\n\n### 🗺️ String Encoding\n\nBy default, bit7z follows the [UTF-8 Everywhere Manifesto](http://utf8everywhere.org/) to simplify the use of the library within cross-platform projects.\nIn short, this means that:\n\n+ The default path string type is `std::string`.\n+ Input `std::string`s are considered as UTF-8 encoded; output `std::string`s are UTF-8 encoded.\n\n\u003cdetails\u003e\n  \u003csummary\u003eExpand for more details and for other string encoding options!\u003c/summary\u003e\n\nOn POSIX systems, `std::string`s are usually already UTF-8 encoded, and no configuration is needed.\n\nThe situation is a bit more complex on Windows since, by default, Windows treats `std::string`s as encoded using the system code page, which may not necessarily be UTF-8, like, for example, [Windows-1252](https://en.wikipedia.org/wiki/Windows-1252).\n\nIf your program deals exclusively with ASCII-only strings, you should be fine with the default bit7z settings (as ASCII characters are also UTF-8).\n\nHowever, if you need to handle non-ASCII/Unicode characters, as it is likely, you have the following options:\n\n+ Enforcing using the UTF-8 code page for your whole application, as explained by Microsoft [here](https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page):\n  + _**Recommended**_, but supported only since Windows 10 1903 and later.\n+ Manually ensuring the encoding of the `std::string`s passed to bit7z:\n  + You can use some string encoding library or C++11's UTF-8 string literals for input strings.\n  + User-input strings (e.g., the password of an archive) can be handled as explained [here](https://nullprogram.com/blog/2020/05/04/); in short: read the input as an UTF-16 wide string (e.g., via `ReadConsoleW`), and convert it to UTF-8 (bit7z provides a utility function for this, `bit7z::to_tstring`).\n  + You can correctly print the UTF-8 output strings from bit7z (e.g., the path/name metadata of a file in an archive) to the console by calling [`SetConsoleOutputCP(CP_UTF8)`](https://learn.microsoft.com/en-us/windows/console/setconsoleoutputcp) before.\n+ Configuring bit7z to use UTF-16 encoded wide strings (i.e., `std::wstring`) by enabling the `BIT7Z_USE_NATIVE_STRING` option via CMake.\n  + If your program is Windows-only, or you already use wide strings on Windows, this might be the best choice since it will avoid any internal string conversions (7-Zip always uses wide strings).\n  + This option makes developing cross-platform applications slightly inconvenient since you'll still have to use `std::string` on POSIX systems.\n  + The library provides a type alias `bit7z::tstring` and a macro function `BIT7Z_STRING` for defining wide string variables and literals on Windows and narrow ones on other platforms.\n  + You must programmatically set the standard input and output encoding to UTF-16 to correctly read and print Unicode characters:\n\n    ```cpp\n    #include \u003cfcntl.h\u003e //for _O_U16TEXT\n    #include \u003cio.h\u003e  //for _setmode\n    \n    _setmode(_fileno(stdout), _O_U16TEXT); // setting the stdout encoding to UTF16\n    _setmode(_fileno(stdin), _O_U16TEXT); // setting the stdin encoding to UTF16\n    ```\n\n+ Configuring bit7z to use the system code page encoding for `std::string` by enabling the `BIT7Z_USE_SYSTEM_CODEPAGE` option via CMake.\n  + _Not recommended_: using this option, your program will be limited in the set of characters it can pass to and read from bit7z.\n\n\u003c/details\u003e\n\n## ☕️ Donate\n\nIf you have found this project helpful, please consider supporting me with a small donation so that I can keep improving it!\nThank you! :pray:\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href='https://github.com/sponsors/rikyoz' target='_blank' title=\"Support the Maintainer via GitHub Sponsors\"\u003e\u003cimg height='24' style='border:0px;height:24px;' src='https://img.shields.io/badge/-Sponsor%20the%20Maintainer-fafbfc?logo=GitHub%20Sponsors' border='0' alt='Sponsor me on GitHub' /\u003e\u003c/a\u003e\u0026thinsp;\u003ca href='https://ko-fi.com/G2G1LS1P' target='_blank' title=\"Support this project via Ko-Fi\"\u003e\u003cimg height='24' style='border:0px;height:24px;' src='https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-red?logo=ko-fi\u0026logoColor=white' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\u0026thinsp;\u003ca href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=NTZF5G7LRXDRC\" title=\"Support this project via PayPal\"\u003e\u003cimg src=\"https://img.shields.io/badge/-Donate%20on%20PayPal-yellow.svg?logo=paypal\u0026logoColor=white\" alt=\"Donations\" height='24' style='border:0px;height:24px;'\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n## 📜 License\n\nThis project is licensed under the terms of the [Mozilla Public License v2.0](https://www.mozilla.org/en-US/MPL/2.0/).\u003cbr/\u003e\nFor more details, please check:\n\n+ The [LICENSE](./LICENSE) file.\n+ [Mozilla's MPL-2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/)\n\nOlder versions (v3.x and earlier) of bit7z were released under the [GNU General Public License v2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).\n\n\u003cbr/\u003e\n\u003cdiv align=\"center\"\u003e\nCopyright \u0026copy; 2014 - 2024 Riccardo Ostani (\u003ca href=\"https://github.com/rikyoz\"\u003e@rikyoz\u003c/a\u003e)\n\u003c/div\u003e\n\u003cbr/\u003e\n","funding_links":["https://github.com/sponsors/rikyoz","https://ko-fi.com/rikyoz","https://github.com/sponsors/rikyoz'","https://ko-fi.com/G2G1LS1P'","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=NTZF5G7LRXDRC"],"categories":["Compression","C++","Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikyoz%2Fbit7z","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frikyoz%2Fbit7z","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frikyoz%2Fbit7z/lists"}