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 of version tags trigger:

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

Configure GitHub secret PYPI_API_TOKEN in repository settings for publishing.

Release flow:

  1. Bump version in pyproject.toml and jzip/__init__.py.
  2. Commit and push to main.
  3. Create and push tag vX.Y.Z (must match pyproject.toml version).

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.1.tar.gz (6.2 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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jzip-1.1.1.tar.gz
  • Upload date:
  • Size: 6.2 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.1.tar.gz
Algorithm Hash digest
SHA256 702dafa9d01355407853ca898f060691912ddd81390a8557e25999c85427d00f
MD5 d6c765ec3512af22a5a4cd46f640e656
BLAKE2b-256 c265ac9481fce6fe9c1c5298fcfc7fce1b177105c63e107f0994f7f127a85ebd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jzip-1.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68617e7137a54a2f957a75c16dddcd6dee085b398a59f1b87120f986c4e90a3c
MD5 95411c21e87ae9bdf010fbdd74004c45
BLAKE2b-256 600fcc8766e7c80b7cdd01b3e1c3b827e4e2d4ecd2801938fcd0b7a031fed300

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