Skip to content
/ pyvlq Public

A Python library for pure Python encoding and decoding of integers using Variable-length quantity.

License

Notifications You must be signed in to change notification settings

osoken/pyvlq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyvlq

pyvlq is a Python library for encoding and decoding Variable-Length Quantity.

The library is available on PyPI and can be installed using pip:

pip install pyvlq

Usage

from io import BytesIO
import pyvlq

# Encode
encoded = pyvlq.encode(128)
print(encoded) # b'\x81\x00'

# Decode
decoded = pyvlq.decode(encoded)
print(decoded) # 128

# Decode from readable bytes
buffer = BytesIO(b'\x81\x00\xff\xff')
decoded = pyvlq.decode_stream(buffer)
print(decoded) # 128 (0xff\xff is ignored)
print(buffer.read(2)) # b'\xff\xff' (0xff\xff is left in the buffer)

About

A Python library for pure Python encoding and decoding of integers using Variable-length quantity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages