Package that lets an application read/write primitive data types from an underlying input/output stream as binary data.
Project description
binario
======
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'
### How to install this package?
### Contribution
======
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'
### How to install this package?
### Contribution
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
binario-0.0.1.zip
(6.3 kB
view details)
File details
Details for the file binario-0.0.1.zip.
File metadata
- Download URL: binario-0.0.1.zip
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcd9a45bf5bc1ae064f91af9781dafbe5d8156f1b8946073a637455b7ee4509d
|
|
| MD5 |
7d3a5a2d273a88db457365806a05062b
|
|
| BLAKE2b-256 |
0c28005a1ad2d23d3774a430a4fe89722b9bec291fc9a891d0493da965b184d5
|