import msgpack from 'msgpack-lite'
import jsonpack from 'jsonpack'
export class Msgpack {
static pack(data: Record<string, any> | Record<string, any>[]): Buffer {
const pack: string = jsonpack.pack(data)
return msgpack.encode(pack)
}
static unpack(data: Buffer | Uint8Array | number[]): any {
const decode: string = msgpack.decode(data)
return jsonpack.unpack(decode)
}
}