Methods
(static) decodeEntity(encoded, clazz)
Deserializes a class instance that was serialized in Google protobuffers format.
Parameters:
Name | Type | Description |
---|---|---|
encoded |
Serialized instance, with class metadata. | |
clazz |
Type parameter specifying class to deserialize to. |
- Source:
Example
const protobuf = require('tanagra-protobuf')
protobuf.init()
const foo = protobuf.decodeEntity(tuple, SomeDecoratedClass)
(static) encodeEntity(instance)
Serializes a decorated class instance as a Google protobuffers binary object.
Parameters:
Name | Type | Description |
---|---|---|
instance |
A decorated class instance. |
- Source:
Example
const protobuf = require('tanagra-protobuf')
protobuf.init()
const foo = new SomeDecoratedClass()
const serialized = protobuf.encodeEntity(foo)
(static) init(serializableTypeMap) → {Promise.<void>}
Initializes the protobuf serializer.
Parameters:
Name | Type | Description |
---|---|---|
serializableTypeMap |
Optional map of (unique key -> prototype) specifying serializable types to add to initial cache. |
- Source: