diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-01-04 21:29:23 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-01-04 21:29:23 (GMT) |
commit | f0d2c3f730a68b986c63715b4efe070f679ff077 (patch) | |
tree | fd581a6602afd767a3d0224522fdd9d3fdc7fb75 /Doc/library/gzip.rst | |
parent | 514d483a7d549db0593510181277164c20b7d9bd (diff) | |
download | cpython-f0d2c3f730a68b986c63715b4efe070f679ff077.zip cpython-f0d2c3f730a68b986c63715b4efe070f679ff077.tar.gz cpython-f0d2c3f730a68b986c63715b4efe070f679ff077.tar.bz2 |
Issue #4272: Add an optional argument to the GzipFile constructor to override the timestamp in the gzip stream.
Diffstat (limited to 'Doc/library/gzip.rst')
-rw-r--r-- | Doc/library/gzip.rst | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index c6f9ef8..fa73bba 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -24,7 +24,7 @@ For other archive formats, see the :mod:`bz2`, :mod:`zipfile`, and The module defines the following items: -.. class:: GzipFile([filename[, mode[, compresslevel[, fileobj]]]]) +.. class:: GzipFile([filename[, mode[, compresslevel[, fileobj[, mtime]]]]]) Constructor for the :class:`GzipFile` class, which simulates most of the methods of a file object, with the exception of the :meth:`readinto` and @@ -52,6 +52,15 @@ The module defines the following items: level of compression; ``1`` is fastest and produces the least compression, and ``9`` is slowest and produces the most compression. The default is ``9``. + The *mtime* argument is an optional numeric timestamp to be written to + the stream when compressing. All :program:`gzip`compressed streams are + required to contain a timestamp. If omitted or ``None``, the current + time is used. This module ignores the timestamp when decompressing; + however, some programs, such as :program:`gunzip`\ , make use of it. + The format of the timestamp is the same as that of the return value of + ``time.time()`` and of the ``st_mtime`` member of the object returned + by ``os.stat()``. + Calling a :class:`GzipFile` object's :meth:`close` method does not close *fileobj*, since you might wish to append more material after the compressed data. This also allows you to pass a :class:`StringIO` object opened for |