Skip to main content

Compressor and decompressor that uses LZW algorithm written in Python3.

REQUIREMENTS

Requires at least Python 3.5.

INSTALLATION

pip install lzw3

USAGE

Two scripts will be installed in your local binary path (e.g. /home/user/.local/bin): compress and uncompress. If you want to invoke these scripts, ensure that your $PATH contains the python binary path Note that this compressor just compress regular files (i.e. doesn’t create an archive such as .zip or .tar.gz). Anyhow, directory can still be compressed using the option: -r

Compression

The compression phases replaces the original files with the compressed ones, appending the extension “.Z”

Compress a list of files:

python3 -m lzw3.compressor doc1.txt doc2.txt

Compress a directory recursively:

python3 -m lzw3.compressor -r /home/user/Docs/Project

Alternatively you can user the compress script as follows:

compress doc1.txt doc2.txt

Options

-r
    Recursively compress the files inside the directories
    within the given file list.
    If not specified, directories in the file list are skipped.

-v
    Prints information about the handled files and the percentage of
    saved space for each compressed file.

-t
    Prints the time spent for compress each file.

-k
    Keeps the original files instead of replace those with the
    compressed ones.

-f
    Force to compress and keep the compressed file, even if the size
    of the compressed file is higher than the size of the original one.

-d
    Prints debug messages.

Decompression

The decompression phases replaces the compressed files (with extension “.Z”) with the uncompressed ones.

Decompress a list of files:

python3 -m lzw3.decompressor doc1.txt.Z doc2.txt.Z

Decompress a directory recursively:

python3 -m lzw3.decompressor -r /home/user/Docs/Project

Alternatively you can user the uncompress script as follows:

uncompress doc1.txt.Z doc2.txt.Z

Options

-r
    Recursively decompress the files inside the directories
    within the given file list.
    If not specified, directories in the file list are skipped.

-v
    Prints information about the handled files.

-t
    Prints the time spent for decompress each file.

-k
    Keeps the decompressed files after the decompression.

-f
    Force to decompress the files even if the file name
    doesn't end with ".Z".

-d
    Prints debug messages.

TESTING

The project comes with few unit tests, both on static or random generated files. To run the tests use:

python3 setup.py test

LICENSE

LZW3 is MIT licensed.

Metadata

Release files for lzw3 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for lzw3 0.4
File Interpreter ABI Platform
lzw3-0.4-py3-none-any.whl Python 3 none any Details

Release files / lzw3-0.4-py3-none-any.whl

Download URL lzw3-0.4-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08e65ff5f95b6c4d918ea798de78551c03f76f371f6d1e7a79f4da0f1bbe04b8
BLAKE2b-256 checksum
How to use checksums
0ae94daca04ab29e60b9550e1175e5163ab0ccd6e955ae2fee0592af35b38b84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.3

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page