Skip to content

Fork of Python zipfile module that adds SOZip optimization

License

Notifications You must be signed in to change notification settings

sozip/sozipfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sozipfile

sozipfile is a fork of Python zipfile module, from its implementation in CPython 3.11, which implements the SOZip optimization, when writing deflate compressed files whose size exceeds the chunk size (defaults to 32768 bytes). It also implements efficient seeking within a SOZip file.

Example to generate a SOZip-optimized file:

import sozipfile.sozipfile as zipfile
with zipfile.ZipFile('my.zip', 'w',
                     compression=zipfile.ZIP_DEFLATED,
                     chunk_size=zipfile.SOZIP_DEFAULT_CHUNK_SIZE) as myzip:
    myzip.write('my.file')

Example to check if a file within a ZIP is SOZip-optimized:

import sozipfile.sozipfile as zipfile
with zipfile.ZipFile('my.zip', 'r') as myzip:
    if myzip.getinfo('my.gpkg').is_sozip_optimized(myzip):
        print('SOZip optimized!')

Available on pypi:

pip install sozipfile

About

Fork of Python zipfile module that adds SOZip optimization

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages