{"id":19492783,"url":"https://github.com/oatpp/oatpp-zlib","last_synced_at":"2025-04-25T20:30:34.605Z","repository":{"id":45302675,"uuid":"229409194","full_name":"oatpp/oatpp-zlib","owner":"oatpp","description":"Module oatpp-zlib provides functionality for compressing/decompressing content with deflate and gzip. Supports both \"Simple\" and \"Async\" oatpp APIs.","archived":false,"fork":false,"pushed_at":"2024-05-19T01:26:28.000Z","size":63,"stargazers_count":5,"open_issues_count":2,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-21T03:25:48.230Z","etag":null,"topics":["cpp","deflate","gzip","oatpp","zlib"],"latest_commit_sha":null,"homepage":"https://oatpp.io/","language":"C++","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/oatpp.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-12-21T10:05:13.000Z","updated_at":"2024-07-02T01:33:37.000Z","dependencies_parsed_at":"2022-09-22T19:52:49.589Z","dependency_job_id":"b85a1d62-8ae1-4de7-809c-30a2318fdec1","html_url":"https://github.com/oatpp/oatpp-zlib","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":"0.16666666666666663","last_synced_commit":"c26ff2c92b9c2abb359458cebe126202fa9a706a"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-zlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-zlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-zlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-zlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oatpp","download_url":"https://codeload.github.com/oatpp/oatpp-zlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250816796,"owners_count":21492028,"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":["cpp","deflate","gzip","oatpp","zlib"],"created_at":"2024-11-10T21:23:00.173Z","updated_at":"2025-04-25T20:30:34.570Z","avatar_url":"https://github.com/oatpp.png","language":"C++","readme":"# oatpp-zlib [![Build Status](https://dev.azure.com/lganzzzo/lganzzzo/_apis/build/status/oatpp.oatpp-zlib?branchName=master)](https://dev.azure.com/lganzzzo/lganzzzo/_build/latest?definitionId=23\u0026branchName=master)\n\nModule `oatpp-zlib` provides functionality for compressing/decompressing content with `deflate` and `gzip`.  \nSupports both \"Simple\" and \"Async\" oatpp APIs.\n\nSee more:\n- [Oat++ Website](https://oatpp.io/)\n- [Oat++ Github Repository](https://github.com/oatpp/oatpp)\n\n## How To Build\n\n### Requires\n\n- ZLib installed.\n\n#### Install ZLib\n\n```bash\nsudo apt-get install zlib1g-dev\n```\n\n### Install oatpp-zlib\n\nClone this repository. In the root of the repository run:\n\n```bash\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake install\n```\n\n## APIs\n\n### Automatically Compress Served Content\n\nConfigure `server::ConnectionHandler` in `AppComponent.hpp`.\n\n```cpp\n#include \"oatpp-zlib/EncoderProvider.hpp\"\n\n...\n\n\nOATPP_CREATE_COMPONENT(std::shared_ptr\u003coatpp::network::server::ConnectionHandler\u003e, serverConnectionHandler)([] {\n\n  OATPP_COMPONENT(std::shared_ptr\u003coatpp::web::server::HttpRouter\u003e, router); // get Router component\n\n  /* Create HttpProcessor::Components */\n  auto components = std::make_shared\u003coatpp::web::server::HttpProcessor::Components\u003e(router);\n\n  /* Add content encoders */\n  auto encoders = std::make_shared\u003coatpp::web::protocol::http::encoding::ProviderCollection\u003e();\n\n  encoders-\u003eadd(std::make_shared\u003coatpp::zlib::DeflateEncoderProvider\u003e());\n  encoders-\u003eadd(std::make_shared\u003coatpp::zlib::GzipEncoderProvider\u003e());\n\n  /* Set content encoders */\n  components-\u003econtentEncodingProviders = encoders;\n\n  /* return HttpConnectionHandler */\n  return std::make_shared\u003coatpp::web::server::HttpConnectionHandler\u003e(components);\n  \n}());\n\n...\n```\n\nNow served content will be automatically compressed and streamed to the client if the client sets `Accept-Encoding` header appropriately.\n\n### Automatically Decompress Uploaded Content\n\nConfigure `server::ConnectionHandler` in `AppComponent.hpp`.\n\n```cpp\n#include \"oatpp-zlib/EncoderProvider.hpp\"\n#include \"oatpp/web/protocol/http/incoming/SimpleBodyDecoder.hpp\"\n\n...\n\nOATPP_CREATE_COMPONENT(std::shared_ptr\u003coatpp::network::server::ConnectionHandler\u003e, serverConnectionHandler)([] {\n\n  OATPP_COMPONENT(std::shared_ptr\u003coatpp::web::server::HttpRouter\u003e, router); // get Router component\n\n  /* Create HttpProcessor::Components */\n  auto components = std::make_shared\u003coatpp::web::server::HttpProcessor::Components\u003e(router);\n\n  /* Add content decoders */\n  auto decoders = std::make_shared\u003coatpp::web::protocol::http::encoding::ProviderCollection\u003e();\n\n  decoders-\u003eadd(std::make_shared\u003coatpp::zlib::DeflateDecoderProvider\u003e());\n  decoders-\u003eadd(std::make_shared\u003coatpp::zlib::GzipDecoderProvider\u003e());\n\n  /* Set Body Decoder */\n  components-\u003ebodyDecoder = std::make_shared\u003coatpp::web::protocol::http::incoming::SimpleBodyDecoder\u003e(decoders);\n\n  /* return HttpConnectionHandler */\n  return std::make_shared\u003coatpp::web::server::HttpConnectionHandler\u003e(components);\n  \n}());\n\n...\n```\n\nNow uploaded content will be automatically decompressed if the client sets `Content-Encoding` header properly.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Foatpp-zlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foatpp%2Foatpp-zlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Foatpp-zlib/lists"}