Skip to main content

Utilities to work with gzip compressed base64 content.

Project description

JZip

CI Publish to PyPI PyPI version

Utilities to work with gzip-compressed base64 content.

Features

  • Decode gzip(base64) to raw bytes
  • Decode gzip(base64) to plain text
  • Convert gzip(base64) to plain base64
  • Compress any file (text or binary) into gzip(base64)
  • Restore original files from gzip(base64) safely
  • CLI support: jzip encode and jzip decode
  • Strict validation with clear errors for invalid base64/gzip input

Installation

pip install jzip

Usage

Compress file to gzip base64

from jzip import compress_file_to_base64

gzip_b64 = compress_file_to_base64("sample.pdf")
print(gzip_b64)

Restore original file from gzip base64

from jzip import write_to_original_file

write_to_original_file(gzip_b64, "sample.pdf")

Decode gzip base64 to bytes/text/plain base64

from jzip import (
    decode_gzip_base64_to_bytes,
    decode_gzip_base64_to_text,
    decode_gzip_base64_to_plain_base64,
)

raw_bytes = decode_gzip_base64_to_bytes(gzip_b64)
text = decode_gzip_base64_to_text(gzip_b64, encoding="utf-8")
plain_b64 = decode_gzip_base64_to_plain_base64(gzip_b64)

CLI

Encode a file

jzip encode ./sample.pdf > sample.gzip.b64

Decode from an argument

jzip decode ./restored.pdf --input "$(cat sample.gzip.b64)"

Decode from stdin

cat sample.gzip.b64 | jzip decode ./restored.pdf

Decode from a file containing base64

jzip decode ./restored.pdf --input-file ./sample.gzip.b64

Automated Release

Pushes to main trigger:

  • tests
  • package build
  • publish to PyPI (skip-existing enabled)

Configure GitHub secret PYPI_API_TOKEN in repository settings for publishing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jzip-1.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jzip-1.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file jzip-1.1.0.tar.gz.

File metadata

  • Download URL: jzip-1.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jzip-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3ed0d63a2ef3dfd20750742eef820cf3201dd3655a0cb34d4661d4f201f8a2a5
MD5 8c76386c4f1526b881acc1769ddb7680
BLAKE2b-256 83fb7586a38a1ca02fbd0fee69a6392a07ab1e4856604acd484b8fd9822c9b0c

See more details on using hashes here.

File details

Details for the file jzip-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: jzip-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jzip-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c54be144356e8a3135542811078315e017d74341df65abf33374cccdb7820829
MD5 4ff734b58dcff9bcac304aa45a671b15
BLAKE2b-256 69affb58a0a436f2ab3fb626d4839ae4716125c1c9f0795bfc3e28a43928792c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page