Skip to main content

Package that lets an application read/write primitive data types from an underlying input/output stream as binary data.

Project description

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?

Just type in your terminal

>>> pip install binario

Where to find documentation?

I make it later ;)

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.

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.3.zip (8.1 kB view details)

Uploaded Source

File details

Details for the file binario-0.0.3.zip.

File metadata

  • Download URL: binario-0.0.3.zip
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for binario-0.0.3.zip
Algorithm Hash digest
SHA256 8781d6373f864c788465e2b18e95f98579c5ee185c00248f4e228540e7d424e7
MD5 262b531ab16bd7b12c63156dbe9cc66f
BLAKE2b-256 2a4bfb5471187063ac5069b371e4b71f3f773768298db28c4f7f9536f250a74f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page