Skip to main content

io.BytesIO that preserves bytes after close

Project description

Python package bytesbufio

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

Python Issue 23099

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.1.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

bytesbufio-1.0.1-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bytesbufio-1.0.1.tar.gz
  • Upload date:
  • Size: 2.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.1.tar.gz
Algorithm Hash digest
SHA256 52db41291e196183470765bc8c0c3ca1014edde64262e4930703bafb2905fe1f
MD5 79d389c8c6c96acd76b7ce2f0443d687
BLAKE2b-256 dce4eb748c456f905ff2e7742431600ea02cade1dc0195400926e7486421b693

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bytesbufio-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b706657f93563fa271c6758136c56fcd6c3186f8341c04263152cd12ae24984
MD5 8721c5e346f241cf7934bc73e41b3c2c
BLAKE2b-256 ab92b0d4759c0bf34cc2d954e1b174b57511db590fe2d1045df7022858ae7987

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