Simple work with binary data.
What is the binario?
binario is the Python package that lets an application read/write primitive data types from an underlying input/output stream as binary data.
And which primitive data types it can process?
It can work with booleans, integers, shorts, long integers, floats, doubles, strings and any byte buffers.
How to write data?
It’s simple. Just create instance of Writer and then do your work:
>>> import binario
>>> w = binario.Writer("file.dat")
>>> w.write_short(2014)
>>> w.write_bool(True)
>>> w.write_float(3.1415)
>>> w.write_string("Hello, world!")
>>> w.write(bytes([128, 20, 10, 255, 0]))
And how to read data?
It’s simple too. Like outputting, create Reader and then do your work:
>>> import binario
>>> r = binario.Reader("file.dat")
>>> r.read_short()
2014
>>> r.read_bool()
True
>>> r.read_float()
3.1415
>>> r.read_string()
"Hello, world!"
>>> r.read(5)
b'\x80\x14\n\xff\x00'
Which byte order specified by default?
By default it is network order (or big-endian).
Okay, it is good, but if I want to change byte order for Reader or Writer?
Not a problem! Just specify it:
>>> import binario
>>> r = binario.Reader("file.dat", binario.LITTLE_ENDIAN)
>>> w = binario.Writer("another_file.dat", binario.BIG_ENDIAN)
What about append new data to existing file?
Yeah, it is also very simple:
>>> import binario
>>> w = binario.Writer("incomplete_file.dat", append=True)
How to install this package?
Just type in your terminal
>>> pip install binario
Where to find documentation?
Contribution
If you do have a contribution for the package feel free to put up a Pull Request or open Issue on GitHub repo: http://github.com/asaskevich/binario.
Metadata
Release files for binario 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| binario-0.0.4.zip | 9.8 kB | Without provenance | Details for binario-0.0.4.zip |
Release files / binario-0.0.4.zip
| Download URL | binario-0.0.4.zip |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50130ba47054bbcbee236d3f378f315985ad6e1ca9eeacce5494c4e102f30c47
|
|
BLAKE2b-256 checksum How to use checksums |
d5f6f676b20fe94cb4df2942f5da75ec945bc11a148989cf8129c74cb2e2d0aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for binario 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.