Skip to content

A convenient wrapper around the struct python module.

License

Notifications You must be signed in to change notification settings

dobryak/pybinio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyBinIO

PyBinIO - is a wrapper around the struct python module. It contains convenient reader and writer classes that can be used to write primitive data types in a specific byte order.

In addition it supports:

  • LEB128 for encoding unsigned variable length integers.
  • Zigzag for encoding signed variable length integers.

Install

The package is available on PyPI.

$ python3 -m pip install pybinio

Usage

import binio

value = 255
writer = binio.BinaryWriter(binio.ByteOrder.LITTLE)
writer.write_uint8(value)

reader = binio.BinaryReader(writer.bytes, binio.ByteOrder.LITTLE)
assert value == reader.read_uint8()