Welcome to edzip’s documentation!¶
- class edzip.EDZipFile(file: str | PathLike | IOBase, ed: ExternalDirectory)[source]¶
Bases:
ZipFileA subclass of ZipFile that reads the directory information from an external SQLite database.
- fillinfo(zinfo: ZipInfo) ZipInfo[source]¶
Fill the given ZipInfo object with further information about the file in the archive.
- Parameters:
zinfo (ZipInfo) – The ZipInfo object to fill in with information.
- Returns:
The filled-in ZipInfo object.
- Return type:
ZipInfo
- getinfo(name) ZipInfo[source]¶
Retrieves information about a file in the archive.
- Parameters:
name (str) – The name of the file to retrieve information for.
- Returns:
- An object containing offset information for the specified file.
Note that the object returned has only offset info filled in. To get all info, call fillinfo() with it.
- Return type:
ZipInfo
- infolist() Sequence[ZipInfo][source]¶
Return a sequence of ZipInfo objects for all files in the archive.
- Returns:
- sequence of ZipInfo objects.
Note that the ZipInfo objects returned have only offset info filled in. To get all info, call fillinfo() with each object.
- Return type:
Sequence[ZipInfo]
- namelist() Sequence[str][source]¶
Returns a sequence of filenames stored in the ZIP archive.
- Returns:
A sequence of filenames.
- Return type:
Sequence[str]
- open(name: str | ZipInfo, mode: str = 'r', pwd: bytes | None = None, *, force_zip6: bool = False) ZipExtFile[source]¶
Open the file specified by ‘name’ inside the ZIP archive for reading.
- Parameters:
- Returns:
A file-like object for reading the contents of the ZIP archive.
- Return type:
ZipExtFile
- stream_from(name: str | ZipInfo | None = None) Generator[tuple[str, int, Generator[bytes, None, None]], None, None][source]¶
Returns a generator that yields a tuple of (filename, file size, file data) for each file in the archive, optionally starting with the specified file.
- Parameters:
name (str or ZipInfo) – Optional. The name of the file to start streaming from, or a ZipInfo object representing the file.
- Yields:
(str,int,Generator[bytes,None,None]) – tuple of (filename, file size, file data) for each file in the archive.