https://github.com/cesbit/qpack
Fast and efficient data serializer (Python)
https://github.com/cesbit/qpack
Last synced: about 2 months ago
JSON representation
Fast and efficient data serializer (Python)
- Host: GitHub
- URL: https://github.com/cesbit/qpack
- Owner: cesbit
- License: mit
- Created: 2016-10-01T13:04:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-28T14:06:37.000Z (over 3 years ago)
- Last Synced: 2025-08-24T17:48:10.411Z (7 months ago)
- Language: C
- Homepage:
- Size: 312 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://github.com/cesbit/qpack/actions)
[](https://github.com/cesbit/qpack/releases)
QPack
=====
QPack is a fast and efficient serialization format like MessagePack.
One key difference is flexible map and array support which allows
to write directly to a qpack buffer without the need to know
the size for the map or array beforehand.
Installation
------------
From PyPI (recommend)
```
pip install qpack
```
From source code
```
python setup.py install
```
Pack
----
`qpack.packb(object)`
Unpack
----
Unpack serialized data. When decode is left None, each string
will be returned as bytes.
`qpack.unpackb(qp, decode=None, ignore_decode_errors=False, use_tuples=False)`
Example
-------
```python
import qpack
# define some test data
data = {'name': 'Iris', 'age': 9}
# serialize into qpack format
qp = qpack.packb(data)
# unpack the serialized data
unpacked = qpack.unpackb(qp, decode='utf-8')
# left see what we've got...
print(unpacked) # {'name': 'Iris', 'age': 3}
```