Class: QgsArchive¶
Manages zip/unzip operations for an archive.
Class Hierarchy¶
Subclasses¶
Allows managing the zip/unzip actions on project files. |
Methods
Add a new file to this archive. |
|
Clear the current content of this archive and create a new temporary directory. |
|
Returns the current temporary directory. |
|
Returns |
|
Returns the list of files within this archive |
|
Remove a file from this archive and from the filesystem. |
|
Zip the content of this archive |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsArchive. See the FAQ for more details.
Clear the current content of this archive and unzip. |
- class qgis.core.QgsArchive[source]¶
Bases:
object
- addFile(self, filename: str | None)[source]¶
Add a new file to this archive. During a zip action, this file will be part of the resulting zipped file.
- Parameters:
filename (Optional[str]) – A file to add when zipping this archive
- clear(self)[source]¶
Clear the current content of this archive and create a new temporary directory.
- exists(self) bool [source]¶
Returns
True
if the archive exists on the filesystem,False
otherwise.Added in version 3.20.
- Return type:
bool
- files(self) List[str] [source]¶
Returns the list of files within this archive
- Return type:
List[str]
- removeFile(self, filename: str | None) bool [source]¶
Remove a file from this archive and from the filesystem.
- Parameters:
filename (Optional[str]) – The path of the file to remove
- Return type:
bool
- Returns:
True
if the file has been removed from the filesystem,False
otherwise
- virtual unzip(self, zipFilename: str | None) bool [source]¶
Clear the current content of this archive and unzip. Files are unzipped in the temporary directory.
- Parameters:
zipFilename (Optional[str]) – The zip file to unzip
- Return type:
bool
- Returns:
True
if unzip action is a success,False
otherwise