Binary serialization using the Binn format.
This module implements a Binn encoder and decoder in pure javascript.
You can check the specs here.
Header
var binn = require('binn.js');
Encoding
var obj = {hello: 'world', number: 123};
var data = binn.encode(obj);
Decoding
var obj = binn.decode(data);
The undefined
value is enconded using the byte 0x03.
It is an extended type derived from the storage type NOBYTES.
Another version in ES6: