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
- 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)
mkdir build
cd build
cmake ..
make
make install#!/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();
}
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!"},
),
});
MIT License - see LICENSE for details.
Copyright 2026 Qore Technologies, s.r.o.