Skip to content

qoretechnologies/module-zip

Repository files navigation

Qore zip Module

Introduction

The zip module provides comprehensive ZIP archive functionality for Qore, including:

  • Creating, reading, and modifying ZIP archives
  • Multiple compression methods: deflate, bzip2, lzma, zstd, xz
  • ZIP64 support for large files (>4GB) and many entries (>65,535)
  • AES encryption (128/192/256-bit)
  • Streaming API for large file operations
  • Data provider module for integration with Qore's data provider framework

Requirements

  • Qore 2.0+
  • CMake 3.5+
  • C++11 compiler
  • zlib (required)
  • bzip2 (optional, for bzip2 compression)
  • liblzma (optional, for lzma/xz compression)
  • zstd (optional, for zstandard compression)
  • OpenSSL (optional, for AES encryption)

Building

mkdir build
cd build
cmake ..
make
make install

Quick Start

#!/usr/bin/qore

%requires zip

# Create a new archive
{
    ZipFile zip("archive.zip", "w");
    zip.addText("readme.txt", "Hello, World!");
    zip.addFile("document.pdf", "/path/to/document.pdf");
    zip.addDirectory("images/");
    zip.close();
}

# Read archive contents
{
    ZipFile zip("archive.zip", "r");
    foreach hash<Qore::Zip::ZipEntryInfo> entry in (zip.entries()) {
        printf("Entry: %s, Size: %d bytes\n", entry.name, entry.size);
    }
    zip.close();
}

# Extract archive
{
    ZipFile zip("archive.zip", "r");
    zip.extractAll("/destination/path");
    zip.close();
}

Data Provider

The module includes ZipDataProvider for use with Qore's data provider framework:

%requires ZipDataProvider

# Get the data provider factory and navigate to the action
AbstractDataProvider dp = DataProvider::getFactoryObjectFromStringEx("zip{}/archive/create");

# Execute the action
hash<auto> result = dp.doRequest({
    "path": "output.zip",
    "files": (
        {"name": "file.txt", "data": "Hello, World!"},
    ),
});

License

MIT License - see LICENSE for details.

Copyright

Copyright 2026 Qore Technologies, s.r.o.

About

Qore zip module for working with ZIP archives

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
COPYING.MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •