Skip to content

A ultra-simplistic zlib.h C++ wrapper that compress std::string_view and std::span<unsigned char>; and decompress it if original uncompressed size is available.

License

Notifications You must be signed in to change notification settings

JordanGaspar/ZLibCPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZLibCPP

This is an ultra-simplistic zlib.h C++ wrapper that compresses (deflate) std::string_view and std::span<unsigned char> array and decompresses (inflate) the same data if its original uncompressed size was stored.

Without the original uncompressed size, it's not possible to decompress(inflate) the data yet.

Usage:

#include <ZLibCPP.hpp>
#include <iostream>
#include <string>

int main(){
    std::string test_data("this is an test");

    ZLibCPP::deflate def(ZLibCPP::best_compression);
    auto compressed = def.compress(test_data);
    auto original_size = test_data.size();

    ZLibCPP::inflate inf;
    auto decompressed = inf.decompress(compressed, orignal_size);

    std::cout << decompressed << std::endl;

    return 0;
}

About

A ultra-simplistic zlib.h C++ wrapper that compress std::string_view and std::span<unsigned char>; and decompress it if original uncompressed size is available.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published