5#include <QtCore/QByteArray>
6#include <QtCore/QIODevice>
7#include <QtCore/QString>
8#include <QtCore/QStringList>
134bool decompressFile(
const QString &inputPath,
const QString &outputPath = QString(),
137 qint64 maxDecompressedBytes = 0);
145 const QString &outputPath = QString(),
146 bool removeOriginal =
false);
154 qint64 maxDecompressedBytes = 0);
167bool extractArchive(
const QString &archivePath,
const QString &outputDirectoryPath,
170 qint64 maxDecompressedBytes = 0);
184 qint64 maxDecompressedBytes = 0);
196 qint64 maxDecompressedBytes = 0);
227bool fileExists(
const QString &archivePath,
const QString &fileName,
236bool extractFile(
const QString &archivePath,
const QString &fileName,
237 const QString &outputPath = QString(),
245QByteArray
extractFileData(
const QString &archivePath,
const QString &fileName,
254bool extractFiles(
const QString &archivePath,
const QStringList &fileNames,
255 const QString &outputDirectoryPath,
266bool extractByPattern(
const QString &archivePath,
const QStringList &patterns,
267 const QString &outputDirectoryPath,
268 QStringList *extractedFiles =
nullptr,
284 qint64 maxDecompressedBytes = 0);
300 qint64 maxDecompressedBytes = 0);
Shared type definitions for compression/archive operations.
std::function< void(int)> ProgressCallback
bool isCompressionFormat(Format format)
Check if format is a compression format (single stream)
bool fileExists(const QString &archivePath, const QString &fileName, Format format)
QByteArray decompressData(const QByteArray &data, Format format, qint64 maxDecompressedBytes)
bool extractArchiveAtomic(const QString &archivePath, const QString &outputDirectoryPath, Format format, ProgressCallback progress, qint64 maxDecompressedBytes)
bool extractArchive(const QString &archivePath, const QString &outputDirectoryPath, Format format, ProgressCallback progress, qint64 maxDecompressedBytes)
bool decompressFile(const QString &inputPath, const QString &outputPath, Format format, ProgressCallback progress, qint64 maxDecompressedBytes)
bool isArchiveFile(const QString &filePath)
Check if file path indicates an archive file (.zip, .tar, .tar.gz, etc.)
std::function< bool(const ArchiveEntry &entry)> EntryFilter
QStringList listArchive(const QString &archivePath, Format format)
bool extractArchiveFiltered(const QString &archivePath, const QString &outputDirectoryPath, EntryFilter filter, ProgressCallback progress, qint64 maxDecompressedBytes)
bool isArchiveFormat(Format format)
Check if format is an archive (contains multiple files)
bool extractByPattern(const QString &archivePath, const QStringList &patterns, const QString &outputDirectoryPath, QStringList *extractedFiles, Format format)
Format detectFormatFromData(const QByteArray &data)
QString lastErrorString()
Get a human-readable error message from the last operation (thread-local)
QString strippedPath(const QString &filePath)
QString detectedFilterName()
bool isCompressedFile(const QString &filePath)
Check if file path indicates a compressed file (.gz, .xz, .zst)
QString errorName(Error error)
Get a human-readable name for an error code.
bool decompressFromDevice(QIODevice *device, const QString &outputPath, ProgressCallback progress, qint64 maxDecompressedBytes)
Format
Archive and compression format types (for decompression)
@ Auto
Auto-detect from file extension or magic bytes.
@ TAR_ZSTD
TAR + Zstandard (.tar.zst)
@ TAR_BZ2
TAR + BZip2 (.tar.bz2, .tbz2)
@ XZ
XZ/LZMA compression (single file, .xz)
@ ZIP
ZIP archive (multiple files)
@ TAR_XZ
TAR + XZ (.tar.xz, .txz)
@ SEVENZ
7-Zip archive (.7z)
@ TAR_LZ4
TAR + LZ4 (.tar.lz4)
@ BZIP2
BZip2 compression (single file, .bz2)
@ ZSTD
Zstandard compression (single file, .zst)
@ TAR_GZ
TAR + GZIP (.tar.gz, .tgz)
@ LZ4
LZ4 compression (single file, .lz4)
@ TAR
TAR archive (uncompressed, multiple files)
@ GZIP
GZIP compression (single file, .gz)
QByteArray extractFileData(const QString &archivePath, const QString &fileName, Format format)
ArchiveStats getArchiveStats(const QString &archivePath, Format format)
QList< ArchiveEntry > listArchiveDetailed(const QString &archivePath, Format format)
Error
Error codes for decompression operations.
@ FileNotFound
Input file does not exist.
@ FileNotInArchive
Requested file not found in archive.
@ PermissionDenied
Cannot read input or write output.
@ InvalidArchive
Archive is corrupt or invalid.
@ InternalError
Unexpected internal error.
@ Cancelled
Operation cancelled by progress callback.
@ SizeLimitExceeded
Decompressed size exceeded limit.
@ UnsupportedFormat
Format not recognized or not supported.
@ IoError
General I/O error (read/write failure)
bool validateArchive(const QString &archivePath, Format format)
bool extractFile(const QString &archivePath, const QString &fileName, const QString &outputPath, Format format)
Error lastError()
Get the error code from the last operation (thread-local)
bool extractFromDevice(QIODevice *device, const QString &outputDirectoryPath, ProgressCallback progress, qint64 maxDecompressedBytes)
QByteArray extractFileDataFromDevice(QIODevice *device, const QString &fileName)
bool extractFiles(const QString &archivePath, const QStringList &fileNames, const QString &outputDirectoryPath, Format format)
QString detectedFormatName()
QString decompressIfNeeded(const QString &filePath, const QString &outputPath, bool removeOriginal)
QString formatExtension(Format format)
Get file extension for a format.
Format detectFormatFromFile(const QString &filePath)
Format detectFormat(const QString &filePath, bool useContentFallback)