msgpack for all
simple-msgpack
is an adaptation from ygeo/msgpack.js
this version is ES7+ and will not work in older browsers.
install the lastest
or just download msgpack.min.js from the repo
Weight Currently
raw: 13.9kb
minified: 5.76kb
minified + gzip: ~2.2kb
API
.encode
put in your objects, arrays, or what ever else JSON would have accepted
.decode
deserialize raw Uint8Arrays straight into what they were before they were encoded
const person = name: 'Bob Guy' languages: 'javascript' 'golang' born: Date const raw = msgpack const decodedPerson = msgpack if decodedPersonname === personname && +decodedPersonborn === +personborn console
tip
if you need to decode a msgpack string, like, say from localStorage for example, then do this:
const data = localStorage const out = msgpack if outrightAsRain console
LICENSE is MIT
Original creator is Yves github.com/ygoe.
This is an adaptation/simplification of
his original project.
This version, like his, is MIT so do what you will with it.