# pyvlq
pyvlq is a Python library for encoding and decoding `Variable-Length Quantity <https://en.wikipedia.org/wiki/Variable-length_quantity>`_.
The library is available on PyPI and can be installed using pip:
```bash
pip install pyvlq
```
## Usage
```python
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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pyvlq",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "VLQ, Variable-length quantity, VINT, integer, encoding, decoding",
"author": "osoken",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/99/a8/6c55fe83f0ada0937840de122158327e05282f1243cee9f89aa7302de430/pyvlq-0.1.1.tar.gz",
"platform": null,
"description": "# pyvlq\npyvlq is a Python library for encoding and decoding `Variable-Length Quantity <https://en.wikipedia.org/wiki/Variable-length_quantity>`_.\n\nThe library is available on PyPI and can be installed using pip:\n\n```bash\npip install pyvlq\n```\n\n## Usage\n```python\nfrom io import BytesIO\nimport pyvlq\n\n# Encode\nencoded = pyvlq.encode(128)\nprint(encoded) # b'\\x81\\x00'\n\n# Decode\ndecoded = pyvlq.decode(encoded)\nprint(decoded) # 128\n\n# Decode from readable bytes\nbuffer = BytesIO(b'\\x81\\x00\\xff\\xff')\ndecoded = pyvlq.decode_stream(buffer)\nprint(decoded) # 128 (0xff\\xff is ignored)\nprint(buffer.read(2)) # b'\\xff\\xff' (0xff\\xff is left in the buffer)\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for pure Python encoding and decoding of integers using Variable-length quantity.",
"version": "0.1.1",
"project_urls": {
"Source": "https://github.com/osoken/pyvlq"
},
"split_keywords": [
"vlq",
" variable-length quantity",
" vint",
" integer",
" encoding",
" decoding"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "aa418e5971ebd3c22d452e9d9e572b76e1db8b79a17bdfefc09905888cf6f62a",
"md5": "e6c3ce29f4e2db9443a33b8c65fdde53",
"sha256": "da248d8484b86cab77c4ceabfadea70704e9530b651d88c94c12acdf5d55861c"
},
"downloads": -1,
"filename": "pyvlq-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e6c3ce29f4e2db9443a33b8c65fdde53",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3508,
"upload_time": "2024-06-25T15:29:07",
"upload_time_iso_8601": "2024-06-25T15:29:07.909247Z",
"url": "https://files.pythonhosted.org/packages/aa/41/8e5971ebd3c22d452e9d9e572b76e1db8b79a17bdfefc09905888cf6f62a/pyvlq-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "99a86c55fe83f0ada0937840de122158327e05282f1243cee9f89aa7302de430",
"md5": "1a28e82b555a3c44e351089809c10e1a",
"sha256": "f1d8c7d8b07f1a7de83f70793e33f0cbceb345262e98809d8fc526ad37870aa5"
},
"downloads": -1,
"filename": "pyvlq-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "1a28e82b555a3c44e351089809c10e1a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3615,
"upload_time": "2024-06-25T15:29:09",
"upload_time_iso_8601": "2024-06-25T15:29:09.792780Z",
"url": "https://files.pythonhosted.org/packages/99/a8/6c55fe83f0ada0937840de122158327e05282f1243cee9f89aa7302de430/pyvlq-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-25 15:29:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "osoken",
"github_project": "pyvlq",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyvlq"
}