This python bindings to libimplode which is a ripped out part of pkglib which is a Free Open-Source implementation of PKWare Data Compression Library (DCL) compression format, which itself was ripped out of Ladislav Zezula's StormLib.
Find a file
2023-10-10 20:29:12 +03:00
.ci Initial commit 2023-10-10 20:29:12 +03:00
.github Initial commit 2023-10-10 20:29:12 +03:00
pkimplode Initial commit 2023-10-10 20:29:12 +03:00
tests Initial commit 2023-10-10 20:29:12 +03:00
.editorconfig Initial commit 2023-10-10 20:29:12 +03:00
.gitattributes Initial commit 2023-10-10 20:29:12 +03:00
.gitignore Initial commit 2023-10-10 20:29:12 +03:00
.gitlab-ci.yml Initial commit 2023-10-10 20:29:12 +03:00
.gitmodules Initial commit 2023-10-10 20:29:12 +03:00
Code_Of_Conduct.md Initial commit 2023-10-10 20:29:12 +03:00
License.md Initial commit 2023-10-10 20:29:12 +03:00
MANIFEST.in Initial commit 2023-10-10 20:29:12 +03:00
pyproject.toml Initial commit 2023-10-10 20:29:12 +03:00
ReadMe.md Initial commit 2023-10-10 20:29:12 +03:00

pkimplode.py

wheel (GitLab) wheel (GHA via nightly.link) GitLab Build Status GitLab Coverage GitHub Actions Libraries.io Status Code style: antiflash License

This are free and Open-Source ctypes-based bindings to libimplode part of pklib which is a ripped out part of pklib which is a Free Open-Source implementation of PKWare Data Compression Library (DCL) compression format, which itself was ripped out of StormLib, all of which are by Ladislav Zezula.

For decompression you need pkblast.py a separate wrapper to a separate library by Mark @madler Adler.

For decompression you can use pkblast.py, pkimplode.py and pwexplode. Read their docs for the info on their installation.

Benefits of CTypes-based impl:

  • Supports python versions other than CPython
  • No need to recompile python module after python version upgrade

Drawbacks:

  • performance and overhead may be worse, than in the case of a cext.

Installation

In order to make it work you need a package with liblast itself installed into your system using your distro package manager. If your distro doesn't provide one, you can build it yourself using CMake CPack from the sources by the link. You will get 2 packages, one with the headers and another one with the shared library. Only the one with the lib is mandatory.

Usage

The package contains multiple functions. They have names matching the regular expression ^decompress(Stream|Bytes(Whole|Chunked))To(Stream|Bytes)$.

The first subgroup describes the type of input argument, the second subgroup describes the type of output.

  • If input is Bytes, then you need
    • Whole, which means that the lib gots a pointer to whole array with compressed data. This is considered to be the optimal input format.
    • Chunked (which means the data are processed in reality by decompressStreamTo$3) was created mainly for convenience of testing.
  • Otherwise it is an object acting like a stream. In this case you can also provide chunkSize, because streams are processed in chunks. Larger the chunk - less the count of chunks in the stream, so less overhead on calls of callbacks, but more memory is needed to store the chunk.

The second subgroup describes the type of the result.

  • The internal type of the result is always a Stream. This is considered to be the optimal output format. It is because we don't know the size of output ahead of time, so have to use streams.
  • Bytes are only for your convenience and just wrap the decompress$1ToStream with a context with BytesIO.