Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
41884a9b
Commit
41884a9b
authored
Jul 17, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New from AMK
parent
0245569f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
0 deletions
+88
-0
Doc/lib/libgzip.tex
Doc/lib/libgzip.tex
+44
-0
Doc/libgzip.tex
Doc/libgzip.tex
+44
-0
No files found.
Doc/lib/libgzip.tex
0 → 100644
View file @
41884a9b
\section
{
Built-in Module
\sectcode
{
gzip
}}
\label
{
module-gzip
}
\bimodindex
{
gzip
}
The data compression provided by the
\code
{
zlib
}
module is compatible
with that used by the GNU compression program
\file
{
gzip
}
.
Accordingly, the
\code
{
gzip
}
module provides the
\code
{
GzipFile
}
class
to read and write
\file
{
gzip
}
-format files, automatically compressing
or decompressing the data so it looks like an ordinary file object.
\code
{
GzipFile
}
objects simulate most of the methods of a file
object, though it's not possible to use the
\code
{
seek()
}
and
\code
{
tell()
}
methods to access the file randomly.
\renewcommand
{
\indexsubitem
}{
(in module gzip)
}
\begin{funcdesc}
{
open
}{
fileobj
\optional
{
\,
filename
\optional
{
\,
mode
\,
compresslevel
}}}
Returns a new
\code
{
GzipFile
}
object on top of
\var
{
fileobj
}
, which
can be a regular file, a
\code
{
StringIO
}
object, or any object which
simulates a file.
The
\file
{
gzip
}
file format includes the original filename of the
uncompressed file; when opening a
\code
{
GzipFile
}
object for
writing, it can be set by the
\var
{
filename
}
argument. The default
value is
\code
{
"GzippedFile"
}
.
\var
{
mode
}
can be either
\code
{
'r'
}
or
\code
{
'w'
}
depending on
whether the file will be read or written.
\var
{
compresslevel
}
is an
integer from 1 to 9 controlling the level of compression; 1 is
fastest and produces the least compression, and 9 is slowest and
produces the most compression. The default value of
\var
{
compresslevel
}
is 9.
Calling a
\code
{
GzipFile
}
object's
\code
{
close()
}
method does not
close
\var
{
fileobj
}
, since you might wish to append more material
after the compressed data. This also allows you to pass a
\code
{
StringIO
}
object opened for writing as
\var
{
fileobj
}
, and
retrieve the resulting memory buffer using the
\code
{
StringIO
}
object's
\code
{
getvalue()
}
method.
\end{funcdesc}
\begin{seealso}
\seemodule
{
zlib
}{
the basic data compression module
}
\end{seealso}
Doc/libgzip.tex
0 → 100644
View file @
41884a9b
\section
{
Built-in Module
\sectcode
{
gzip
}}
\label
{
module-gzip
}
\bimodindex
{
gzip
}
The data compression provided by the
\code
{
zlib
}
module is compatible
with that used by the GNU compression program
\file
{
gzip
}
.
Accordingly, the
\code
{
gzip
}
module provides the
\code
{
GzipFile
}
class
to read and write
\file
{
gzip
}
-format files, automatically compressing
or decompressing the data so it looks like an ordinary file object.
\code
{
GzipFile
}
objects simulate most of the methods of a file
object, though it's not possible to use the
\code
{
seek()
}
and
\code
{
tell()
}
methods to access the file randomly.
\renewcommand
{
\indexsubitem
}{
(in module gzip)
}
\begin{funcdesc}
{
open
}{
fileobj
\optional
{
\,
filename
\optional
{
\,
mode
\,
compresslevel
}}}
Returns a new
\code
{
GzipFile
}
object on top of
\var
{
fileobj
}
, which
can be a regular file, a
\code
{
StringIO
}
object, or any object which
simulates a file.
The
\file
{
gzip
}
file format includes the original filename of the
uncompressed file; when opening a
\code
{
GzipFile
}
object for
writing, it can be set by the
\var
{
filename
}
argument. The default
value is
\code
{
"GzippedFile"
}
.
\var
{
mode
}
can be either
\code
{
'r'
}
or
\code
{
'w'
}
depending on
whether the file will be read or written.
\var
{
compresslevel
}
is an
integer from 1 to 9 controlling the level of compression; 1 is
fastest and produces the least compression, and 9 is slowest and
produces the most compression. The default value of
\var
{
compresslevel
}
is 9.
Calling a
\code
{
GzipFile
}
object's
\code
{
close()
}
method does not
close
\var
{
fileobj
}
, since you might wish to append more material
after the compressed data. This also allows you to pass a
\code
{
StringIO
}
object opened for writing as
\var
{
fileobj
}
, and
retrieve the resulting memory buffer using the
\code
{
StringIO
}
object's
\code
{
getvalue()
}
method.
\end{funcdesc}
\begin{seealso}
\seemodule
{
zlib
}{
the basic data compression module
}
\end{seealso}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment