Skip to main content

Archive

The external API class that encapsulates an archive implementation.

Attributes

AttributeTypeDescription
_archiveobjectThe internal archive implementation instance used to perform file extraction, listing, and closing operations.

Constructor

Signature

def Archive(
file: [Union](../../contrib/gis/db/models/functions/union.md?sid=django_contrib_gis_db_models_functions_union)[str, file-like object]
) - > null

Parameters

NameTypeDescription
file[Union](../../contrib/gis/db/models/functions/union.md?sid=django_contrib_gis_db_models_functions_union)[str, file-like object]The path to the archive file or a file-like object representing the archive.

Methods


extract()

@classmethod
def extract(
to_path: string
) - > null

Extracts the entire contents of the archive to the specified local directory path.

Parameters

NameTypeDescription
to_pathstringThe destination directory path where the archive contents will be extracted.

Returns

TypeDescription
null

list()

@classmethod
def list() - > null

Lists the contents of the archive, typically printing or returning the metadata of the files contained within.

Returns

TypeDescription
null

close()

@classmethod
def close() - > null

Closes the underlying archive file handle and releases associated system resources.

Returns

TypeDescription
null