Debian Codegraph @

docs/lz4.frame.rst

raw
1 .. default-role:: obj
2 .. py:module:: lz4.frame
3
4 lz4.frame sub-package
5 =====================
6
7 This sub-package is in beta testing. Ahead of version 1.0 there may be API
8 changes, but these are expected to be minimal, if any.
9
10 This sub-package provides the capability to compress and decompress data using
11 the `LZ4 frame specification <http://lz4.github.io/lz4/lz4_Frame_format.html>`_.
12
13 The frame specification is recommended for most applications. A key benefit of
14 using the frame specification (compared to the block specification) is
15 interoperability with other implementations.
16
17
18 Low level bindings for full content (de)compression
19 ---------------------------------------------------
20
21 These functions are bindings to the LZ4 Frame API functions for compressing data
22 into a single frame, and decompressing a full frame of data.
23
24 .. autofunction:: lz4.frame.compress
25 .. autofunction:: lz4.frame.decompress
26
27
28 Low level bindings for chunked content (de)compression
29 ------------------------------------------------------
30
31 These functions are bindings to the LZ4 Frame API functions allowing piece-wise
32 compression and decompression. Using them requires managing compression and
33 decompression contexts manually. An alternative to using these is to use the
34 context manager classes described in the section below.
35
36
37 Compression
38 ~~~~~~~~~~~
39
40 .. autofunction:: lz4.frame.create_compression_context
41 .. autofunction:: lz4.frame.compress_begin
42 .. autofunction:: lz4.frame.compress_chunk
43 .. autofunction:: lz4.frame.compress_flush
44
45
46 Decompression
47 ~~~~~~~~~~~~~
48
49 .. autofunction:: lz4.frame.create_decompression_context
50 .. autofunction:: lz4.frame.reset_decompression_context
51 .. autofunction:: lz4.frame.decompress_chunk
52
53
54 Retrieving frame information
55 ----------------------------
56
57 The following function can be used to retrieve information about a compressed frame.
58
59 .. autofunction:: lz4.frame.get_frame_info
60
61
62 Helper context manager classes
63 ------------------------------
64
65 These classes, which utilize the low level bindings to the Frame API are more
66 convenient to use. They provide context management, and so it is not necessary
67 to manually create and manage compression and decompression contexts.
68
69 .. autoclass:: lz4.frame.LZ4FrameCompressor
70 :members:
71 .. autoclass:: lz4.frame.LZ4FrameDecompressor
72 :members:
73
74 Reading and writing compressed files
75 ------------------------------------
76
77 These provide capability for reading and writing of files using LZ4 compressed
78 frames. These are designed to be drop in replacements for the LZMA, BZ2 and Gzip
79 equivalent functionalities in the Python standard library.
80
81 .. autofunction:: lz4.frame.open
82 .. autoclass:: lz4.frame.LZ4FrameFile
83 :members:
84
85 Module attributes
86 -----------------
87
88 A number of module attributes are defined for convenience. These are detailed below.
89
90 Compression level
91 ~~~~~~~~~~~~~~~~~
92
93 The following module attributes can be used when setting the
94 ``compression_level`` argument.
95
96 .. autodata:: lz4.frame.COMPRESSIONLEVEL_MIN
97 :annotation:
98
99 .. autodata:: lz4.frame.COMPRESSIONLEVEL_MINHC
100 :annotation:
101
102 .. autodata:: lz4.frame.COMPRESSIONLEVEL_MAX
103 :annotation:
104
105 Block size
106 ~~~~~~~~~~
107
108 The following attributes can be used when setting the ``block_size`` argument.
109
110 .. autodata:: lz4.frame.BLOCKSIZE_DEFAULT
111 :annotation:
112
113 .. autodata:: lz4.frame.BLOCKSIZE_MAX64KB
114 :annotation:
115
116 .. autodata:: lz4.frame.BLOCKSIZE_MAX256KB
117 :annotation:
118
119 .. autodata:: lz4.frame.BLOCKSIZE_MAX1MB
120 :annotation:
121
122 .. autodata:: lz4.frame.BLOCKSIZE_MAX4MB
123 :annotation: