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()
>>> r.read_bool()
>>> r.read_float()
>>> r.read_string()
"Hello, world!"

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?

Look here:


If you do have a contribution for the package feel free to put up a Pull Request or open Issue on GitHub repo:

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date (9.8 kB) Copy SHA256 hash SHA256 Source None Aug 21, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page