How to get binary data from Python's ByteIO
Use the getvalue()
function of the BytesIO
instance. Example:
#!/usr/bin/env python3
from io import BytesIO
myio = BytesIO()
myio.write(b"Test 123")
print(myio.getvalue()) # Prints b'Test 123'
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow