Skip to content

Scondo/py-zopfli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PYZOPFLI

cPython bindings for zopfli.

USAGE

pyzopfli is a package which allows using zopfli library in Python.

Main public module is pyzopfli.zlib. It provides emulation of standard zlib module and can be used in any application as drop-in replace. Decompression functions are imported in pyzopfli.zlib from zlib.

import pyzopfli.zlib as zlib

pyzopfli may be used with gzip or zipfile modules of standard library by replacing their zlib module attribute in runtime.

import pyzopfli.zlib as zlib
import zipfile
zipfile.zlib = zlib

You also can slightly cheat and control power of compression with 'levit' attribute of pyzopli.zlib module

import pyzopfli.zlib as zlib
zlib.levit[zlib.Z_DEFAULT_COMPRESSION] = iterations

pyzopfli.zlib passes standard's library unittest with same failures as native zlib (few failures are errors of decompressor) Same for gzip and zipfile modules with replaced zlib.

TODO

  • Zopfli isn't optimal for already compressed file. Post-processing required to keep some blocks uncompressed.

About

Python bindings for zopfli

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 53.4%
  • C 46.6%