diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-02-07 22:02:25 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-02-07 22:02:25 (GMT) |
commit | 503f908090bd22df70ed21e3bb3c2513a1eee969 (patch) | |
tree | 2722994f3caf3551cf4cfe9556df3f27b4d58e78 /Doc/library/zipfile.rst | |
parent | 46988d365946f2b61812b6ff60cb557e036fa6b1 (diff) | |
download | cpython-503f908090bd22df70ed21e3bb3c2513a1eee969.zip cpython-503f908090bd22df70ed21e3bb3c2513a1eee969.tar.gz cpython-503f908090bd22df70ed21e3bb3c2513a1eee969.tar.bz2 |
Issue #26039: Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir().
Patch by Thomas Kluyver.
Diffstat (limited to 'Doc/library/zipfile.rst')
-rw-r--r-- | Doc/library/zipfile.rst | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index e3c2217..54b8cc5 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -465,6 +465,22 @@ Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object stores information about a single member of the ZIP archive. +There is one classmethod to make a :class:`ZipInfo` instance for a filesystem +file: + +.. classmethod:: ZipInfo.from_file(filename, arcname=None) + + Construct a :class:`ZipInfo` instance for a file on the filesystem, in + preparation for adding it to a zip file. + + *filename* should be the path to a file or directory on the filesystem. + + If *arcname* is specified, it is used as the name within the archive. + If *arcname* is not specified, the name will be the same as *filename*, but + with any drive letter and leading path separators removed. + + .. versionadded:: 3.6 + Instances have the following attributes: @@ -574,3 +590,11 @@ Instances have the following attributes: .. attribute:: ZipInfo.file_size Size of the uncompressed file. + +There is one method: + +.. method:: ZipInfo.is_dir() + + Return ``True`` if the ZipInfo represents a directory. + + .. versionadded:: 3.6 |