zlib

Version:

1.2.11

Category:

tools

Cluster:

Loki

Author / Distributor

https://www.zlib.net/

Description

The zlib library is a general purpose data compression library. The code is thread safe, assuming that the standard library functions used are thread safe, such as memory allocation routines. It provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithmsmay be added later with the same stream interface.

Documentation

Example usage in C:

#include <zlib.h>
#include <stdio.h>

int main() {
    const char *source = "Hello, zlib!";
    unsigned char compressed[50];
    unsigned long compressed_length = sizeof(compressed);

    if (compress(compressed, &compressed_length, (const unsigned char *)source, strlen(source)) == Z_OK) {
        printf("Compression successful! Compressed size: %lu\n", compressed_length);
    } else {
        printf("Compression failed.\n");
    }

    return 0;
}

Examples/Usage

  • Load the zlib module:

    $ module load zlib
    
  • Check the loaded modules:

    $ module list
    
  • List available modules:

    $ module avail zlib
    
  • Unload the zlib module:

    $ module unload zlib
    
  • Verify zlib installation using pkg-config:

    $ pkg-config --modversion zlib
    

Installation

Source code is obtained from Zlib