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 22003 - BytesIO and shared bufferes
- Python Issue 23099 - value not available after close
License
Copyright (c) 2020 by Cornelius Buschka.
Project details
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
Close
Hashes for bytesbufio-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4063ff349b28bdc1458f425cf47597de06d01dbbbc6a3687271b4b7b1fe38eb |
|
MD5 | fe9626da9cc0b3af74e7c8eddc15bed9 |
|
BLAKE2b-256 | 83fb954032f95ddefd56200be4d26d9dacb553628379fdb042b775bfd00a8a3e |