{"id":13645729,"url":"https://github.com/mapbox/gzip-hpp","last_synced_at":"2026-01-12T07:36:22.993Z","repository":{"id":24507266,"uuid":"101338887","full_name":"mapbox/gzip-hpp","owner":"mapbox","description":"Gzip header-only C++ library","archived":false,"fork":false,"pushed_at":"2023-07-26T14:55:53.000Z","size":221,"stargazers_count":344,"open_issues_count":18,"forks_count":68,"subscribers_count":115,"default_branch":"master","last_synced_at":"2025-06-04T17:11:37.639Z","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":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-08-24T21:24:41.000Z","updated_at":"2025-06-04T07:12:46.000Z","dependencies_parsed_at":"2024-01-11T14:25:59.821Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/gzip-hpp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mapbox/gzip-hpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgzip-hpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgzip-hpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgzip-hpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgzip-hpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/gzip-hpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fgzip-hpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28336582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"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":[],"created_at":"2024-08-02T01:02:40.649Z","updated_at":"2026-01-12T07:36:22.977Z","avatar_url":"https://github.com/mapbox.png","language":"C++","readme":"Gzip C++ lib for gzip compression and decompression. Extracted from [mapnik-vector-tile](https://github.com/mapbox/mapnik-vector-tile) for light-weight modularity.\n\n[![Build Status](https://travis-ci.com/mapbox/gzip-hpp.svg?branch=master)](https://travis-ci.com/mapbox/gzip-hpp)\n[![hpp-skel badge](https://raw.githubusercontent.com/mapbox/cpp/master/assets/hpp-skel-badge_blue.svg)](https://github.com/mapbox/hpp-skel)\n\n## Usage\n```c++\n// Include the specific gzip headers your code needs, for example...\n#include \u003cgzip/compress.hpp\u003e\n#include \u003cgzip/config.hpp\u003e\n#include \u003cgzip/decompress.hpp\u003e\n#include \u003cgzip/utils.hpp\u003e\n#include \u003cgzip/version.hpp\u003e\n\n// All function calls must pass in a pointer of an \n// immutable character sequence (aka a string in C) and its size\nstd::string data = \"hello\";\nconst char * pointer = data.data();\nstd::size_t size = data.size();\n\n// Check if compressed. Can check both gzip and zlib.\nbool c = gzip::is_compressed(pointer, size); // false\n\n// Compress returns a std::string\nstd::string compressed_data = gzip::compress(pointer, size);\n\n// Decompress returns a std::string and decodes both zlib and gzip\nconst char * compressed_pointer = compressed_data.data();\nstd::string decompressed_data = gzip::decompress(compressed_pointer, compressed_data.size());\n\n// Or like so\nstd::string compressed_data = gzip::compress(tile-\u003edata(), tile-\u003edata.size());\n\n// Or like so\nstd::string value = gzip::compress(node::Buffer::Data(obj), node::Buffer::Length(obj));\n\n// Or...etc\n\n```\n#### Compress\n```c++\n// Optionally include compression level\nstd::size_t size; // No default value, but what happens when not passed??\nint level = Z_DEFAULT_COMPRESSION; // Z_DEFAULT_COMPRESSION is the default if no arg is passed\n\nstd::string compressed_data = gzip::compress(tile-\u003edata(), size, level);\n```\n#### Decompress\n```c++\n// No args other than the std:string\nstd::string data = \"hello\";\nstd::string compressed_data = gzip::compress(data);\nconst char * compressed_pointer = compressed_data.data();\n\nstd::string decompressed_data = gzip::decompress(compressed_pointer, compressed_data.size());\n\n```\n\n## Test\n\n```shell\n# build test binaries\nmake\n\n# run tests\nmake test\n```\n\nYou can make Release test binaries as well\n```shell\nBUILDTYPE=Release make\nBUILDTYPE=Release make test\n```\n\n## Versioning\n\nThis library is semantically versioned using the /include/gzip/version.cpp file. This defines a number of macros that can be used to check the current major, minor, or patch versions, as well as the full version string.\n\nHere's how you can check for a particular version to use specific API methods\n```c++\n#if GZIP_VERSION_MAJOR \u003e 2\n// use version 2 api\n#else\n// use older verion apis\n#endif\n```\n\nHere's how to check the version string\n```c++\nstd::cout \u003c\u003c \"version: \" \u003c\u003c GZIP_VERSION_STRING \u003c\u003c \"/n\";\n// =\u003e version: 0.2.0\n```\n\nAnd lastly, mathematically checking for a specific version:\n```c++\n#if GZIP_VERSION_CODE \u003e 20001\n// use feature provided in v2.0.1\n#endif\n```\n","funding_links":[],"categories":["C++","Compression"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fgzip-hpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fgzip-hpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fgzip-hpp/lists"}