@@ -29,6 +29,24 @@ from cpython.bytes cimport PyBytes_FromStringAndSize
29
29
cdef extern from " <Python.h>" :
30
30
const Py_ssize_t PY_SSIZE_T_MAX
31
31
32
+ """
33
+ Pythonic interface to ISA-L's igzip_lib.
34
+
35
+ This module comes with the following constants:
36
+ ============================== ================================================
37
+ Constant Meaning
38
+ ============================== ================================================
39
+ ``ISAL_BEST_SPEED`` The lowest compression level (0)
40
+ ``ISAL_BEST_COMPRESSION`` The highest compression level (3)
41
+ ``ISAL_DEFAULT_COMPRESSION`` The compromise compression level (2)
42
+ ``DEF_BUF_SIZE`` Default size for the starting buffer (16K)
43
+ ``MAX_HIST_BITS`` Maximum window size bits (15).
44
+ ``COMP_DEFLATE`` Flag to compress to a raw deflate block
45
+ ``COMP_GZIP`` Flag to compress a gzip block, consisting of a
46
+ gzip header, raw deflate block and a gzip
47
+ trailer.
48
+ ``COMP_GZIP_NO_HDR`` Compress
49
+ """
32
50
ISAL_BEST_SPEED = ISAL_DEF_MIN_LEVEL
33
51
ISAL_BEST_COMPRESSION = ISAL_DEF_MAX_LEVEL
34
52
cdef int ISAL_DEFAULT_COMPRESSION_I = 2
@@ -135,6 +153,19 @@ cpdef compress(data,
135
153
compression (NOT no compression as in stdlib zlib!) and the
136
154
fastest. 3 is the best compression and the slowest. Default
137
155
is a compromise at level 2.
156
+ :param flag: Controls the header and trailer. Can be any of: COMP_DEFLATE
157
+ (default), COMP_GZIP, COMP_GZIP_NO_HDR, COMP_ZLIB,
158
+ COMP_ZLIB_NO_HDR.
159
+ :param mem_level: Set the memory level for the memory buffer. Larger
160
+ buffers improve performance. Can be any of:
161
+ MEM_LEVEL_DEFAULT (default,
162
+ equivalent to MEM_LEVEL_LARGE), MEM_LEVEL_MIN,
163
+ MEM_LEVEL_SMALL, MEM_LEVEL_MEDIUM, MEM_LEVEL_LARGE,
164
+ MEM_LEVEL_EXTRA_LARGE.
165
+ :param hist_bits: Sets the size of the view window. The size equals
166
+ 2^hist_bits. Similar to zlib wbits value, except that
167
+ hist_bits is not used to set the compression flag.
168
+ This is best left at the default (15, maximum).
138
169
"""
139
170
# Initialise stream
140
171
cdef isal_zstream stream
@@ -193,14 +224,26 @@ cpdef compress(data,
193
224
194
225
195
226
cpdef decompress(data,
196
- unsigned int flag = ISAL_DEFLATE,
197
- unsigned int hist_bits = ISAL_DEF_MAX_HIST_BITS,
198
- Py_ssize_t bufsize = DEF_BUF_SIZE):
227
+ int flag = ISAL_DEFLATE,
228
+ int hist_bits = ISAL_DEF_MAX_HIST_BITS,
229
+ Py_ssize_t bufsize = DEF_BUF_SIZE):
199
230
"""
200
231
Deompresses the bytes in *data*. Returns a bytes object with the
201
232
decompressed data.
202
233
203
- :param bufsize: The initial size of the output buffer.
234
+ :param flag: Whether the compressed block contains headers and/or trailers
235
+ and of which type. Can be any of: DECOMP_DEFLATE (default),
236
+ DECOMP_GZIP, DECOMP_GZIP_NO_HDR, DECOMP_GZIP_NO_HDR_VER,
237
+ DECOMP_ZLIB, DECOMP_ZLIB_NO_HDR, DECOMP_ZLIB_NO_HDR_VER.
238
+ :param hist_bits: Sets the size of the view window. The size equals
239
+ 2^hist_bits. Similar to zlib wbits value, except that
240
+ hist_bits is not used to set the compression flag.
241
+ This is best left at the default (15, maximum).
242
+ :param bufsize: The initial size of the output buffer. The output buffer
243
+ is dynamically resized according to the need. The default
244
+ size is 16K. If a larger output is expected, using a
245
+ larger buffer will improve performance by negating the
246
+ costs associated with the dynamic resizing.
204
247
"""
205
248
if bufsize < 0 :
206
249
raise ValueError (" bufsize must be non-negative" )
0 commit comments