Skip to main content

Base64 stream encode/decode library

Project description

Version Python versions Build Status License

b64-stream

b64-stream is a Python binding for the b64-stream. This is Base64 stream encode/decode library.

Installation

pip install b64-stream

Getting started

b64-stream implements classes:

  1. Base64StreamDecode
  2. Base64StreamEncode

Every class has:

  1. __init__(buffer_size: int = 2000) - buffer_size used by create buffer for update method for new encoded/decoded chunk.
  2. buffer_size - size of buffer
  3. total - total encoded/decoded bytes
  4. clear() - reset state to initial
  5. update(chunk) - processing chunk
  6. finalize() - end of processing

Usage examples

Decode data

from b64_stream import Base64StreamDecode

chunks = [b'MTIzNDU2', b'NzEyMzQ1Njc=']
result = []
decoder = Base64StreamDecode()
for chunk in chunks:
    for r_chunk in decoder.update(chunk):
        result.append(r_chunk)
decoder.finalize()

Encode data

chunks = [b'1234567', b'1234567']
encoder = Base64StreamEncode()
result = []
for chunk in chunks:
    for r_chunk in encoder.update(chunk):
        result.append(r_chunk)
result.append(encoder.finalize())

License

b64-stream is licensed under the Apache 2.0 License.

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

b64-stream-1.0.0.tar.gz (70.7 kB view hashes)

Uploaded Source

Built Distributions

b64_stream-1.0.0-cp38-cp38-manylinux2014_x86_64.whl (233.4 kB view hashes)

Uploaded CPython 3.8

b64_stream-1.0.0-cp37-cp37m-manylinux2014_x86_64.whl (211.9 kB view hashes)

Uploaded CPython 3.7m

b64_stream-1.0.0-cp36-cp36m-manylinux2014_x86_64.whl (211.7 kB view hashes)

Uploaded CPython 3.6m

Supported by

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