Get started with msgpack5 CDN
MIT licensed
MsgPack.js: Lightweight library for encoding/decoding MsgPack messages in JS.
Tags:- msgpack
- extension
- v5
- ext
Stable version
Copied!
How to start using msgpack5 CDN
// Include msgpack5 library from CDN
const msgpack = require('msgpack5/msgpack5.min.js');
// Serialize an object to msgpack format
const dataToSerialize = { name: 'John Doe', age: 30 };
const serializedData = new Uint8Array(msgpack.encode(dataToSerialize));
// Print serialized data as a base64 string for easier sharing
console.log(btoa(String.fromCharCode.apply(null, new Uint16Array(new Uint8Array(serializedData.buffer).buffer).buffer)));
// Deserialize msgpack data
const deserializedData = msgpack.decode(new Uint8Array(new TextEncoder().encode('ASDFASDFASDFASDFASDFASDF'))); // Replace with actual msgpack data
console.log(deserializedData); // Output: { name: 'John Doe', age: 30 }
Copied!
Copied!