Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 908 Bytes

msgpack_codec.rst

File metadata and controls

39 lines (23 loc) · 908 Bytes

MessagePack Codec

Codec for serialising and de-serialising data in MessagePack format. Supports both array and objects for mapping into resources or collections of resources.

The MessagePack codec uses the :pymsgpack-python module.

odin.codecs.msgpack_codec

Methods

load

loads

dump

dumps

Customising Encoding

Serialisation of Odin resources is handled by a customised :pymsgpack.Packer. Additional data types can be appended to the :pyodin.codecs.msgpack_codec.TYPE_SERIALIZERS dictionary.

Example usage

Loading a resource from a file:

from odin.codecs import msgpack_codec

with open('my_resource.msgp') as f:
    resource = msgpack_codec.load(f)