Skip to main content

better than original base64

Project description

b64fx

b64fx is a Python library for encoding and decoding data in various base formats with optional compression support. It provides both synchronous and asynchronous APIs for efficient processing of data.

Features

  • Encode/decode with Base16, Base32, Base32hex, Base64, Base85, Ascii85, and Z85.
  • URL-safe Base64 encoding and decoding.
  • Optional LZ4 compression/decompression for efficient storage.
  • Async file encoding/decoding for handling large data without blocking.
  • Compatible with Python 3.8+.

Installation

From PyPI (if uploaded)

pip install b64fx

Usage

All-in-one example:

import asyncio
import b64fx

# Original data
data = "Hello, world! This is a test string."
print("Original:", data)

# ===== Synchronous compression + Base64 =====
encoded = b64fx.encz(data)
print("Compressed + Encoded:", encoded)

decoded = b64fx.decz(encoded)
print("Decoded + Decompressed:", decoded.decode('utf-8'))

# ===== Base Encodings =====
raw_bytes = data.encode('utf-8')

# Base64
b64 = b64fx.standard_b64encode(raw_bytes)
print("Base64:", b64)
print("Base64 Decoded:", b64fx.standard_b64decode(b64))

# URL-safe Base64
url_b64 = b64fx.urlsafe_b64encode(raw_bytes)
print("URL-safe Base64:", url_b64)
print("URL-safe Base64 Decoded:", b64fx.urlsafe_b64decode(url_b64))

# Base32
b32 = b64fx.b32encode(raw_bytes)
print("Base32:", b32)
print("Base32 Decoded:", b64fx.b32decode(b32))

# Base32hex
b32hex = b64fx.b32hexencode(raw_bytes)
print("Base32hex:", b32hex)
print("Base32hex Decoded:", b64fx.b32hexdecode(b32hex))

# Base85 / Ascii85 / Z85
b85 = b64fx.b85encode(raw_bytes)
print("Base85:", b85)
print("Base85 Decoded:", b64fx.b85decode(b85))

a85 = b64fx.a85encode(raw_bytes)
print("Ascii85:", a85)
print("Ascii85 Decoded:", b64fx.a85decode(a85))

z85 = b64fx.z85encode(raw_bytes)
print("Z85:", z85)
print("Z85 Decoded:", b64fx.z85decode(z85))

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

b64fx-1.0.2.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file b64fx-1.0.2.tar.gz.

File metadata

  • Download URL: b64fx-1.0.2.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for b64fx-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f63be1a19d9c82bfce2b9382528e00c0c35d34a7b15ad30533a30d1a73cc056f
MD5 c44e6858c3029001d1720a9cd455be50
BLAKE2b-256 443dd5b1628cce3cf7db2ab96a372f0662f54f135e405e99459ff25c74759a14

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