Subgroup: other

Class: QgsArchive

class qgis.core.QgsArchive

Bases: sip.wrapper

Constructor

QgsArchive(other: QgsArchive) Copy constructor

Class allowing to manage the zip/unzip actions

New in version 3.0: Methods

addFile Add a new file to this archive.
clear Clear the current content of this archive and create a new temporary directory.
dir Returns the current temporary directory.
files Returns the list of files within this archive
removeFile Remove a file from this archive and from the filesystem.
unzip Clear the current content of this archive and unzip.
zip Zip the content of this archive

Signals

Attributes

addFile(self, filename: str)

Add a new file to this archive. During a zip action, this file will be part of the resulting zipped file.

Parameters:filename – A file to add when zipping this archive
clear(self)

Clear the current content of this archive and create a new temporary directory.

dir(self) → str

Returns the current temporary directory.

files(self) → List[str]

Returns the list of files within this archive

removeFile(self, filename: str) → bool

Remove a file from this archive and from the filesystem.

Parameters:filename – The path of the file to remove
Returns:true if the file has been removed from the filesystem, false otherwise
unzip(self, zipFilename: str) → bool

Clear the current content of this archive and unzip. Files are unzipped in the temporary directory.

Parameters:zipFilename – The zip file to unzip
Returns:true if unzip action is a success, false otherwise
zip(self, zipFilename: str) → bool

Zip the content of this archive

Parameters:zipFilename – The name of the zip to generate
Returns:false if something goes wrong, true otherwise