QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Functions
QgsZipUtils Namespace Reference

Functions

CORE_EXPORT bool decodeGzip (const char *bytesIn, std::size_t size, QByteArray &bytesOut)
 Decodes gzip byte stream, returns true on success.
 
CORE_EXPORT bool decodeGzip (const QByteArray &bytesIn, QByteArray &bytesOut)
 Decodes gzip byte stream, returns true on success.
 
CORE_EXPORT bool encodeGzip (const QByteArray &bytesIn, QByteArray &bytesOut)
 Encodes gzip byte stream, returns true on success.
 
CORE_EXPORT const QStringList files (const QString &zip)
 Returns the list of files within a zip file.
 
CORE_EXPORT bool isZipFile (const QString &filename)
 Returns true if the file name is a zipped file ( i.e with a '.qgz' extension, false otherwise.
 
CORE_EXPORT bool unzip (const QString &zip, const QString &dir, QStringList &files, bool checkConsistency=true)
 Unzip a zip file in an output directory.
 
CORE_EXPORT bool zip (const QString &zip, const QStringList &files)
 Zip the list of files in the zip file.
 

Function Documentation

◆ decodeGzip() [1/2]

bool QgsZipUtils::decodeGzip ( const char *  bytesIn,
std::size_t  size,
QByteArray &  bytesOut 
)

Decodes gzip byte stream, returns true on success.

Useful for reading vector tiles.

Note
Not available in Python bindings
Since
QGIS 3.26

Definition at line 200 of file qgsziputils.cpp.

◆ decodeGzip() [2/2]

bool QgsZipUtils::decodeGzip ( const QByteArray &  bytesIn,
QByteArray &  bytesOut 
)

Decodes gzip byte stream, returns true on success.

Useful for reading vector tiles.

Note
Not available in Python bindings
Since
QGIS 3.26

Definition at line 195 of file qgsziputils.cpp.

◆ encodeGzip()

bool QgsZipUtils::encodeGzip ( const QByteArray &  bytesIn,
QByteArray &  bytesOut 
)

Encodes gzip byte stream, returns true on success.

Useful for writing vector tiles.

Note
Not available in Python bindings
Since
QGIS 3.26

Definition at line 255 of file qgsziputils.cpp.

◆ files()

const QStringList QgsZipUtils::files ( const QString &  zip)

Returns the list of files within a zip file.

Since
QGIS 3.30

Definition at line 297 of file qgsziputils.cpp.

◆ isZipFile()

bool QgsZipUtils::isZipFile ( const QString &  filename)

Returns true if the file name is a zipped file ( i.e with a '.qgz' extension, false otherwise.

Parameters
filenameThe name of the file
Returns
true if the file is zipped, false otherwise

Definition at line 32 of file qgsziputils.cpp.

◆ unzip()

bool QgsZipUtils::unzip ( const QString &  zip,
const QString &  dir,
QStringList &  files,
bool  checkConsistency = true 
)

Unzip a zip file in an output directory.

Parameters
zipThe zip filename
dirThe output directory
filesThe absolute path of unzipped files
checkConsistencyPerform additional stricter consistency checks on the archive, and error if they fail (since QGIS 3.30)
Returns
false if the zip filename does not exist, the output directory does not exist or is not writable.

Definition at line 37 of file qgsziputils.cpp.

◆ zip()

bool QgsZipUtils::zip ( const QString &  zip,
const QStringList &  files 
)

Zip the list of files in the zip file.

If the zip file already exists or is empty, an error is returned. If an input file does not exist, an error is also returned.

Parameters
zipThe zip filename
filesThe absolute path to files to embed within the zip

Definition at line 135 of file qgsziputils.cpp.