{"id":20904007,"url":"https://github.com/getnamo/7zip-cpp","last_synced_at":"2025-05-16T10:05:40.186Z","repository":{"id":2672846,"uuid":"47132017","full_name":"getnamo/7zip-cpp","owner":"getnamo","description":"Fork of SevenZip++ for modern builds.","archived":false,"fork":false,"pushed_at":"2024-12-05T03:53:03.000Z","size":11075,"stargazers_count":240,"open_issues_count":14,"forks_count":95,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-05-16T10:04:17.116Z","etag":null,"topics":["7zip","cpp","sevenzip","unzip","vs2015","zip"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getnamo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":"LICENSE.txt","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":"2015-11-30T16:39:37.000Z","updated_at":"2025-04-07T13:52:28.000Z","dependencies_parsed_at":"2024-12-31T10:09:23.399Z","dependency_job_id":"496dd03c-e11d-43d4-a7c7-d8a825d93389","html_url":"https://github.com/getnamo/7zip-cpp","commit_stats":{"total_commits":189,"total_committers":11,"mean_commits":"17.181818181818183","dds":0.671957671957672,"last_synced_commit":"f8e9a4548d2c91a8705a8cf91f732ffbf16aba07"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnamo%2F7zip-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnamo%2F7zip-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnamo%2F7zip-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getnamo%2F7zip-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getnamo","download_url":"https://codeload.github.com/getnamo/7zip-cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082891,"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":["7zip","cpp","sevenzip","unzip","vs2015","zip"],"created_at":"2024-11-18T13:15:43.771Z","updated_at":"2025-05-16T10:05:40.162Z","avatar_url":"https://github.com/getnamo.png","language":"C++","readme":"[![Build status](https://ci.appveyor.com/api/projects/status/11i6cncafgey8lt3?svg=true)](https://ci.appveyor.com/project/getnamo/7zip-cpp)\n\n# 7zip-cpp\nA fork of [SevenZip++](http://bitbucket.org/cmcnab/sevenzip/wiki/Home) for modern builds. Uses cmake to generate build files for desired Visual Studio version, see [setup section for instructions](https://github.com/getnamo/7zip-cpp#using-git-and-cmake).\n\nUses latest lzma1801 SDK\n\n#### Notes\nOriginally from:\n[http://bitbucket.org/cmcnab/sevenzip/wiki/Home](http://bitbucket.org/cmcnab/sevenzip/wiki/Home)\n\n\nThis is a C++ wrapper for accessing the 7-zip COM-like API in 7z.dll and 7za.dll. This code is heavily based off of the Client7z sample found in the [LZMA SDK](http://www.7-zip.org/sdk.html).\n\nThe project itself is a static library.\n\n### Basic Usage\n\nTo use, first load the 7z DLL into memory:\n\n```cpp\n#include \u003c7zpp/7zpp.h\u003e\n\nSevenZip::SevenZipLibrary lib;\nlib.Load();\n```\n\nIf the appropriate 7z DLL is not in your path you may wish to specify it explicitly in the call to load. Note you may have the 64-bit version installed but are trying to load it from a 32-bit executable; keep that in mind if you encounter errors.\n\n```cpp\nlib.Load(_T(\"path\\\\to\\\\7za.dll\"));\n```\n\nThen create and use a compressor:\n\n```cpp\nSevenZip::SevenZipCompressor compressor(lib, archiveName);\ncompressor.SetCompressionFormat(SevenZip::CompressionFormat::Zip);\ncompressor.UseAbsolutePaths(false);\ncompressor.AddFile(targetFile);\ncompressor.AddDirectory(targetDir);\ncompressor.DoCompress(callbackfunc);\n```\n\nOr an extractor:\n\n```cpp\nSevenZip::SevenZipExtractor extractor(lib, archiveName);\n\n// Try to detect compression type\nif (!extractor.DetectCompressionFormat())\n{\n\textractor.SetCompressionFormat(SevenZip::CompressionFormat::Zip);\n}\n\n...\n\n// Change this function to suit\nSevenZip::ProgressCallBack *extractcallbackfunc = nullptr;\n\n...\n\nextractor.ExtractArchive(destination, extractcallbackfunc);\n```\n\nOr a lister:\n\n```cpp\nclass ListCallBackOutput : SevenZip::ListCallback\n{\n\tvirtual void OnFileFound(WCHAR* path, ULONGLONG size)\n\t{\n\t\tstd::wcout\n\t\t\t\u003c\u003c path\n\t\t\t\u003c\u003c L\" \"\n\t\t\t\u003c\u003c size\n\t\t\t\u003c\u003c std::endl;\n\t}\n};\n\n...\n\nSevenZip::SevenZipLister lister(lib, archiveName);\n\n// Try to detect compression type\nif (!lister.DetectCompressionFormat())\n{\n\tlister.SetCompressionFormat(SevenZip::CompressionFormat::Zip);\n}\n\nListCallBackOutput myListCallBack;\n\n\nlister.ListArchive((SevenZip::ListCallback *)\u0026myListCallBack);\n```\n\nNote:  Most of the functions now return a boolean to indicate if it worked\ninstead of throwing an exception.\n\nOtherwise, don't forget to wrap the operations in a try/catch block to handle errors:\n\n```cpp\n...\ncatch (SevenZip::SevenZipException\u0026 ex)\n{\n    std::cerr \u003c\u003c ex.GetMessage() \u003c\u003c std::endl;\n}\n...\n```\n\n## Setup and Installation\n\n### Using git and cmake\n1. Ensure you have [cmake](https://cmake.org/download/) and [git](https://git-scm.com/downloads) installed. Navigate to folder of choice.\n2. Open a powershell window and type ```git clone https://github.com/getnamo/7zip-cpp.git --recursive```\n3. Navigate into the newly cloned project ```cd 7zip-cpp```\n4. (Optional for Test app only) Download and build [Boost](https://www.boost.org/users/download/)\n5. Example build with cmake using powershell\n```plain \ncd build\ncmake -G \"Visual Studio 15 2017 Win64\" ../\ncmake --build ../build --config Release\n```\n6. Commands from 5 will build win64 Release target and output will be found in ```build/Release/7zpp.lib```\n\n### How to use this library in my project\nAdd project into your cmakelists \n\n```plain\nadd_subdirectory(${pathto7zip-cpp} ${PROJECT_SOURCE_DIR}/build/build7zpp)\ntarget_include_directories(${my_project} INTERFACE ${pathto7zip-cpp}/Include)\ntarget_link_libraries(${my_project} 7zpp)\nadd_dependencies(${my_project}  7zpp) #might not be necessary\n```\n\n### Test Requirements\n\nIn order to compile the tests,you must have boost libraries in your path or specify the location where cmake can find them\n\n1. Assuming you're in the project directory\n2. Download and build [Boost](https://www.boost.org/users/download/)\n```plain\ncd build\ncmake ../ -DBOOST_ROOT=\"My boost location\"\n```\n2. Then finally `cmake --build ../build` to build\n\n\n## Known Issues\n\n~~Only 1 test unit is failing.~~\n\n## Contributing\n\nRead Contributing.md\n\n### Branches\n\n- Devel branch is the bleeding edge, but it should still work.\n- Devel-XXX branches are current topics.\n- Master branch is the latest stable version.\n- More branch information is in Contributing.md.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetnamo%2F7zip-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetnamo%2F7zip-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetnamo%2F7zip-cpp/lists"}