Class: exports

exports

Uses the standard JSON serialization methods for converting to and from JSON strings (and buffers). Buffers are converted to the format of {type:'Buffer', data:xxxxx } If a object has a toJSON() method then that will be used - as this uses the stadnard JSON.stringify() approach

new exports()

Methods


fromBuffer(data)

Inflates the data to the object or other type If on inflation the object has a type field that will throw an error if it is not 'Buffer'
Parameters:
Name Type Description
data Buffer byte buffer containing the data
Returns:
the resulting type
Type
Object

toBuffer(result)

Takes the result and produces a buffer that matches this serialization format
Parameters:
Name Type Description
result Object to be converted
Returns:
container the encoded data
Type
Buffer