File: lz4.frame.rst

package info (click to toggle)
python-lz4 4.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 552 kB
  • sloc: ansic: 3,089; python: 2,668; makefile: 147
file content (123 lines) | stat: -rw-r--r-- 3,526 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
.. default-role:: obj
.. py:module:: lz4.frame

lz4.frame sub-package
=====================

This sub-package is in beta testing. Ahead of version 1.0 there may be API
changes, but these are expected to be minimal, if any.

This sub-package provides the capability to compress and decompress data using
the `LZ4 frame specification <http://lz4.github.io/lz4/lz4_Frame_format.html>`_.

The frame specification is recommended for most applications. A key benefit of
using the frame specification (compared to the block specification) is
interoperability with other implementations.


Low level bindings for full content (de)compression
---------------------------------------------------

These functions are bindings to the LZ4 Frame API functions for compressing data
into a single frame, and decompressing a full frame of data.

.. autofunction:: lz4.frame.compress
.. autofunction:: lz4.frame.decompress


Low level bindings for chunked content (de)compression
------------------------------------------------------

These functions are bindings to the LZ4 Frame API functions allowing piece-wise
compression and decompression. Using them requires managing compression and
decompression contexts manually. An alternative to using these is to use the
context manager classes described in the section below.


Compression
~~~~~~~~~~~

.. autofunction:: lz4.frame.create_compression_context
.. autofunction:: lz4.frame.compress_begin
.. autofunction:: lz4.frame.compress_chunk
.. autofunction:: lz4.frame.compress_flush


Decompression
~~~~~~~~~~~~~

.. autofunction:: lz4.frame.create_decompression_context
.. autofunction:: lz4.frame.reset_decompression_context
.. autofunction:: lz4.frame.decompress_chunk


Retrieving frame information
----------------------------

The following function can be used to retrieve information about a compressed frame.

.. autofunction:: lz4.frame.get_frame_info


Helper context manager classes
------------------------------

These classes, which utilize the low level bindings to the Frame API are more
convenient to use. They provide context management, and so it is not necessary
to manually create and manage compression and decompression contexts.

.. autoclass:: lz4.frame.LZ4FrameCompressor
   :members:
.. autoclass:: lz4.frame.LZ4FrameDecompressor
   :members:

Reading and writing compressed files
------------------------------------

These provide capability for reading and writing of files using LZ4 compressed
frames. These are designed to be drop in replacements for the LZMA, BZ2 and Gzip
equivalent functionalities in the Python standard library.

.. autofunction:: lz4.frame.open
.. autoclass:: lz4.frame.LZ4FrameFile
   :members:

Module attributes
-----------------

A number of module attributes are defined for convenience. These are detailed below.

Compression level
~~~~~~~~~~~~~~~~~

The following module attributes can be used when setting the
``compression_level`` argument.

.. autodata:: lz4.frame.COMPRESSIONLEVEL_MIN
   :annotation:

.. autodata:: lz4.frame.COMPRESSIONLEVEL_MINHC
   :annotation:

.. autodata:: lz4.frame.COMPRESSIONLEVEL_MAX
   :annotation:

Block size
~~~~~~~~~~

The following attributes can be used when setting the ``block_size`` argument.

.. autodata:: lz4.frame.BLOCKSIZE_DEFAULT
   :annotation:

.. autodata:: lz4.frame.BLOCKSIZE_MAX64KB
   :annotation:

.. autodata:: lz4.frame.BLOCKSIZE_MAX256KB
   :annotation:

.. autodata:: lz4.frame.BLOCKSIZE_MAX1MB
   :annotation:

.. autodata:: lz4.frame.BLOCKSIZE_MAX4MB
   :annotation: