mirror of
https://github.com/google/brotli.git
synced 2024-11-09 21:50:07 +00:00
Python: Publicly expose the Compressor object in the Python API (#456)
Progress on #191
This commit is contained in:
parent
5632315d35
commit
afb1272792
@ -16,6 +16,9 @@ MODE_GENERIC = _brotli.MODE_GENERIC
|
||||
MODE_TEXT = _brotli.MODE_TEXT
|
||||
MODE_FONT = _brotli.MODE_FONT
|
||||
|
||||
# The Compressor object.
|
||||
Compressor = _brotli.Compressor
|
||||
|
||||
# Compress a byte string.
|
||||
def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0,
|
||||
dictionary=''):
|
||||
@ -42,8 +45,8 @@ def compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0,
|
||||
Raises:
|
||||
brotli.error: If arguments are invalid, or compressor fails.
|
||||
"""
|
||||
compressor = _brotli.Compressor(mode=mode, quality=quality, lgwin=lgwin,
|
||||
lgblock=lgblock, dictionary=dictionary)
|
||||
compressor = Compressor(mode=mode, quality=quality, lgwin=lgwin,
|
||||
lgblock=lgblock, dictionary=dictionary)
|
||||
return compressor.process(string) + compressor.finish()
|
||||
|
||||
# Decompress a compressed byte string.
|
||||
|
Loading…
Reference in New Issue
Block a user