mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Patch #1446489 (zipfile: support for ZIP64)
This commit is contained in:
parent
0eac11826a
commit
143cefb846
5 changed files with 665 additions and 63 deletions
|
@ -17,7 +17,8 @@ understanding of the format, as defined in
|
|||
Note}.
|
||||
|
||||
This module does not currently handle ZIP files which have appended
|
||||
comments, or multi-disk ZIP files.
|
||||
comments, or multi-disk ZIP files. It can handle ZIP files that use the
|
||||
ZIP64 extensions (that is ZIP files that are more than 4 GByte in size).
|
||||
|
||||
The available attributes of this module are:
|
||||
|
||||
|
@ -25,6 +26,11 @@ The available attributes of this module are:
|
|||
The error raised for bad ZIP files.
|
||||
\end{excdesc}
|
||||
|
||||
\begin{excdesc}{LargeZipFile}
|
||||
The error raised when a ZIP file would require ZIP64 functionality but that
|
||||
has not been enabled.
|
||||
\end{excdesc}
|
||||
|
||||
\begin{classdesc*}{ZipFile}
|
||||
The class for reading and writing ZIP files. See
|
||||
``\citetitle{ZipFile Objects}'' (section \ref{zipfile-objects}) for
|
||||
|
@ -77,7 +83,7 @@ The available attributes of this module are:
|
|||
|
||||
\subsection{ZipFile Objects \label{zipfile-objects}}
|
||||
|
||||
\begin{classdesc}{ZipFile}{file\optional{, mode\optional{, compression}}}
|
||||
\begin{classdesc}{ZipFile}{file\optional{, mode\optional{, compression\optional{, allowZip64}}}}
|
||||
Open a ZIP file, where \var{file} can be either a path to a file
|
||||
(a string) or a file-like object. The \var{mode} parameter
|
||||
should be \code{'r'} to read an existing file, \code{'w'} to
|
||||
|
@ -100,6 +106,12 @@ cat myzip.zip >> python.exe
|
|||
is specified but the \refmodule{zlib} module is not available,
|
||||
\exception{RuntimeError} is also raised. The default is
|
||||
\constant{ZIP_STORED}.
|
||||
If \var{allowZip64} is \code{True} zipfile will create zipfiles that use
|
||||
the ZIP64 extensions when the zipfile is larger than 2GBytes. If it is
|
||||
false (the default) zipfile will raise an exception when the zipfile would
|
||||
require ZIP64 extensions. ZIP64 extensions are disabled by default because
|
||||
the default zip and unzip commands on Unix (the InfoZIP utilities) don't
|
||||
support these extensions.
|
||||
\end{classdesc}
|
||||
|
||||
\begin{methoddesc}{close}{}
|
||||
|
@ -132,8 +144,8 @@ cat myzip.zip >> python.exe
|
|||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{testzip}{}
|
||||
Read all the files in the archive and check their CRC's. Return the
|
||||
name of the first bad file, or else return \code{None}.
|
||||
Read all the files in the archive and check their CRC's and file
|
||||
headers. Return the name of the first bad file, or else return \code{None}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{write}{filename\optional{, arcname\optional{,
|
||||
|
@ -284,10 +296,6 @@ Instances have the following attributes:
|
|||
Byte offset to the file header.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[ZipInfo]{file_offset}
|
||||
Byte offset to the start of the file data.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[ZipInfo]{CRC}
|
||||
CRC-32 of the uncompressed file.
|
||||
\end{memberdesc}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue