########
base64io
########
.. image:: https://img.shields.io/pypi/v/base64io.svg
:target: https://pypi.python.org/pypi/base64io
:alt: Latest Version
.. image:: https://img.shields.io/pypi/pyversions/base64io.svg
:target: https://pypi.python.org/pypi/base64io
:alt: Supported Python Versions
.. image:: https://img.shields.io/badge/code_style-black-000000.svg
:target: https://github.com/ambv/black
:alt: Code style: black
.. image:: https://readthedocs.org/projects/base64io-python/badge/
:target: https://base64io-python.readthedocs.io/en/stable/
:alt: Documentation Status
.. image:: https://travis-ci.org/aws/base64io-python.svg?branch=master
:target: https://travis-ci.org/aws/base64io-python
.. image:: https://ci.appveyor.com/api/projects/status/ds8xvogp4m70j9ks?svg=true
:target: https://ci.appveyor.com/project/mattsb42-aws/base64io-python-36722
This project is designed to develop a class, ``base64io.Base64IO``, that implements
a streaming interface for Base64 encoding.
Python has supported native Base64 encoding since version 2.4. However, there is no
streaming interface for Base64 encoding, and none is available from the community.
The legacy ``base64.encode`` and ``base64.decode`` interface lets you shuffle data between
two streams, but it assumes that you have two complete streams. We wanted a
standard stream that applies Base64 encoding and decoding.
``base64io.Base64IO`` provides an `io` streaming interface with context manager
support that transparently Base64-encodes data read from it. You can use it to transform
large files without caching the entire context in memory, or to transform an existing
stream.
For the latest full documentation, see `Read the Docs`_.
Find us on `GitHub`_.
***************
Getting Started
***************
``base64io.Base64IO`` has no dependencies other than the standard library and should
work with any version of Python greater than 2.6. We test it on CPython 2.6, 2.7, 3.3,
3.4, 3.5, 3.6, and 3.7.
Installation
============
.. code::
$ pip install base64io
***
Use
***
``base64io.Base64IO`` wraps the input stream and transparently encodes or decodes
data written to or read from the input stream.
* ``write()`` encodes data before writing it to the wrapped stream
* ``read()`` decodes data after reading it from the wrapped stream
Because the position of the ``base64io.Base64IO`` stream and the wrapped stream will
almost always be different, ``base64io.Base64IO`` does not support:
* ``seek()``
* ``tell()``
Also, ``base64io.Base64IO`` does not support:
* ``fileno()``
* ``truncate()``
Encode data
===========
.. warning::
If you are not using ``base64io.Base64IO`` as a context manager, when you write to
a ``base64io.Base64IO`` stream, you **must** close the stream after your final
write. The Base64 transformation might hold up to two bytes of unencoded data in an
internal buffer before writing it to the wrapped stream. Calling ``close()`` flushes
this buffer and writes the padded result to the wrapped stream. The
``base64io.Base64IO`` context manager does this for you.
.. code-block:: python
from base64io import Base64IO
with open("source_file", "rb") as source, open("encoded_file", "wb") as target:
with Base64IO(target) as encoded_target:
for line in source:
encoded_target.write(line)
Decode data
===========
.. note::
When it reads data from the wrapping stream, it might read up to three additional bytes
from the underlying stream.
.. code-block:: python
from base64io import Base64IO
with open("encoded_file", "rb") as encoded_source, open("target_file", "wb") as target:
with Base64IO(encoded_source) as source:
for line in source:
target.write(line)
*******
License
*******
This library is licensed under the Apache 2.0 License.
.. _Read the Docs: http://base64io-python.readthedocs.io/en/latest/
.. _GitHub: https://github.com/aws/base64io-python/
.. _base64 documentation: https://docs.python.org/3/library/base64.html#base64.decode
Raw data
{
"_id": null,
"home_page": "https://github.com/aws/base64io-python",
"name": "base64io",
"maintainer": "Amazon Web Services",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "base64 stream",
"author": "Amazon Web Services",
"author_email": "aws-cryptools@amazon.com",
"download_url": "https://files.pythonhosted.org/packages/a5/5e/5bf8377df11c190df3db242129739c532f396be185d63eb4222a1dbf62ce/base64io-1.0.3.tar.gz",
"platform": "",
"description": "########\nbase64io\n########\n\n.. image:: https://img.shields.io/pypi/v/base64io.svg\n :target: https://pypi.python.org/pypi/base64io\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/base64io.svg\n :target: https://pypi.python.org/pypi/base64io\n :alt: Supported Python Versions\n\n.. image:: https://img.shields.io/badge/code_style-black-000000.svg\n :target: https://github.com/ambv/black\n :alt: Code style: black\n\n.. image:: https://readthedocs.org/projects/base64io-python/badge/\n :target: https://base64io-python.readthedocs.io/en/stable/\n :alt: Documentation Status\n\n.. image:: https://travis-ci.org/aws/base64io-python.svg?branch=master\n :target: https://travis-ci.org/aws/base64io-python\n\n.. image:: https://ci.appveyor.com/api/projects/status/ds8xvogp4m70j9ks?svg=true\n :target: https://ci.appveyor.com/project/mattsb42-aws/base64io-python-36722\n\nThis project is designed to develop a class, ``base64io.Base64IO``, that implements\na streaming interface for Base64 encoding.\n\nPython has supported native Base64 encoding since version 2.4. However, there is no\nstreaming interface for Base64 encoding, and none is available from the community.\n\nThe legacy ``base64.encode`` and ``base64.decode`` interface lets you shuffle data between\ntwo streams, but it assumes that you have two complete streams. We wanted a\nstandard stream that applies Base64 encoding and decoding.\n\n``base64io.Base64IO`` provides an `io` streaming interface with context manager\nsupport that transparently Base64-encodes data read from it. You can use it to transform\nlarge files without caching the entire context in memory, or to transform an existing\nstream.\n\nFor the latest full documentation, see `Read the Docs`_.\n\nFind us on `GitHub`_.\n\n***************\nGetting Started\n***************\n\n``base64io.Base64IO`` has no dependencies other than the standard library and should\nwork with any version of Python greater than 2.6. We test it on CPython 2.6, 2.7, 3.3,\n3.4, 3.5, 3.6, and 3.7.\n\nInstallation\n============\n\n.. code::\n\n $ pip install base64io\n\n***\nUse\n***\n``base64io.Base64IO`` wraps the input stream and transparently encodes or decodes\ndata written to or read from the input stream.\n\n* ``write()`` encodes data before writing it to the wrapped stream\n* ``read()`` decodes data after reading it from the wrapped stream\n\nBecause the position of the ``base64io.Base64IO`` stream and the wrapped stream will\nalmost always be different, ``base64io.Base64IO`` does not support:\n\n* ``seek()``\n* ``tell()``\n\nAlso, ``base64io.Base64IO`` does not support:\n\n* ``fileno()``\n* ``truncate()``\n\nEncode data\n===========\n\n.. warning::\n\n If you are not using ``base64io.Base64IO`` as a context manager, when you write to\n a ``base64io.Base64IO`` stream, you **must** close the stream after your final\n write. The Base64 transformation might hold up to two bytes of unencoded data in an\n internal buffer before writing it to the wrapped stream. Calling ``close()`` flushes\n this buffer and writes the padded result to the wrapped stream. The\n ``base64io.Base64IO`` context manager does this for you.\n\n.. code-block:: python\n\n from base64io import Base64IO\n\n with open(\"source_file\", \"rb\") as source, open(\"encoded_file\", \"wb\") as target:\n with Base64IO(target) as encoded_target:\n for line in source:\n encoded_target.write(line)\n\nDecode data\n===========\n\n.. note::\n\n When it reads data from the wrapping stream, it might read up to three additional bytes\n from the underlying stream.\n\n.. code-block:: python\n\n from base64io import Base64IO\n\n with open(\"encoded_file\", \"rb\") as encoded_source, open(\"target_file\", \"wb\") as target:\n with Base64IO(encoded_source) as source:\n for line in source:\n target.write(line)\n\n*******\nLicense\n*******\n\nThis library is licensed under the Apache 2.0 License.\n\n.. _Read the Docs: http://base64io-python.readthedocs.io/en/latest/\n.. _GitHub: https://github.com/aws/base64io-python/\n.. _base64 documentation: https://docs.python.org/3/library/base64.html#base64.decode\n\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/aws/base64io-python"
},
"split_keywords": [
"base64",
"stream"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c79c401865bd07802b916c327342ed609f9ac0aa8c6c48bea1a32b7eabc17229",
"md5": "d7269162ab03be13fb212e17c90e2878",
"sha256": "e9a6c9f470e34f8debaad26134bcf3f0bcbf677dac73e32295cfb2915d30815b"
},
"downloads": -1,
"filename": "base64io-1.0.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d7269162ab03be13fb212e17c90e2878",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 17315,
"upload_time": "2018-12-10T20:40:45",
"upload_time_iso_8601": "2018-12-10T20:40:45.870303Z",
"url": "https://files.pythonhosted.org/packages/c7/9c/401865bd07802b916c327342ed609f9ac0aa8c6c48bea1a32b7eabc17229/base64io-1.0.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a55e5bf8377df11c190df3db242129739c532f396be185d63eb4222a1dbf62ce",
"md5": "96e8d5f62b7b237de3259d8b7c808886",
"sha256": "24f2d0fe765c35339e1b2d33aa95f9137b1b765b594164fad1016c15827a7073"
},
"downloads": -1,
"filename": "base64io-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "96e8d5f62b7b237de3259d8b7c808886",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16640,
"upload_time": "2018-12-10T20:40:47",
"upload_time_iso_8601": "2018-12-10T20:40:47.466286Z",
"url": "https://files.pythonhosted.org/packages/a5/5e/5bf8377df11c190df3db242129739c532f396be185d63eb4222a1dbf62ce/base64io-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2018-12-10 20:40:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aws",
"github_project": "base64io-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "base64io"
}