Subgroup: Zip

Class: QgsZipUtils

class qgis.core.QgsZipUtils

Bases: sip.simplewrapper

Methods

isZipFile Returns true if the file name is a zipped file ( i.e with a ‘.qgz’ extension, false otherwise.
unzip Unzip a zip file in an output directory.
zip Zip the list of files in the zip file.

Signals

Attributes

isZipFile(filename: str) → bool

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

Parameters:filename – The name of the file
Returns:true if the file is zipped, false otherwise
unzip(zip: str, dir: str) → Tuple[bool, List[str]]

Unzip a zip file in an output directory. An error is returned if the zip filename does not exist, the output directory does not exist or is not writable.

Parameters:
  • zip – The zip filename
  • dir – The output directory
  • files – The absolute path of unzipped files

New in version 3.0.

zip(zip: str, files: Iterable[str]) → bool

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:
  • zip – The zip filename
  • files – The absolute path to files to embed within the zip

New in version 3.0.