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.2.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for bytesbufio-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dd082a88c9bee1afbd80a52c4dbe99033be8885c9a07cf0e579091e1193e87a |
|
MD5 | 7f22d19db92228fe9ff57ee70b990158 |
|
BLAKE2b-256 | b1442c0b7e4b8b1cfed62c17b81e14794772d1d0329882da1c53fb9b1ed1e051 |