Skip to main content

io.BytesIO that preserves bytes after close

Project description

Python package bytesbufio

Sources Written in Python PyPI Build Status codecov License

bytesbufio provides BytesBufferIO - an io.BytesIO implementation whose value can be accessed after it has been closed

Installation

pip install bytesbufio

Usage

import io

from bytesbufio import BytesBufferIO

bytesbuf = BytesBufferIO()
with io.TextIOWrapper(bytesbuf, encoding='utf-8') as textout:
    textout.write("Hello world.")

text = bytesbuf.getvalue().decode('utf-8') # BytesIO would have raised an ValueError here 
print(text)

Related

License

Copyright (c) 2020 by Cornelius Buschka.

Apache License, Version 2.0

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

bytesbufio-1.0.3.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

bytesbufio-1.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file bytesbufio-1.0.3.tar.gz.

File metadata

  • Download URL: bytesbufio-1.0.3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for bytesbufio-1.0.3.tar.gz
Algorithm Hash digest
SHA256 a2cb1986e7c7a57cb7c204196a20178f381676503cd984786789a77e351bd62d
MD5 801f769b1a9203216f9055c04b420156
BLAKE2b-256 63469b8a5d4df43b559072af6e7bfd56b51c018eca9818f77eb72925ea530621

See more details on using hashes here.

File details

Details for the file bytesbufio-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: bytesbufio-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for bytesbufio-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e4063ff349b28bdc1458f425cf47597de06d01dbbbc6a3687271b4b7b1fe38eb
MD5 fe9626da9cc0b3af74e7c8eddc15bed9
BLAKE2b-256 83fb954032f95ddefd56200be4d26d9dacb553628379fdb042b775bfd00a8a3e

See more details on using hashes here.

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