Closed meloalright closed 2 years ago
Hey @meloalright ! You should first decode it using the function msgpack.decode
( not TextDecoder's decode
):
const { encode, decode } = require('@msgpack/msgpack');
const encoded = encode({ name: 'abcde' });
const decoded = decode(encoded);
console.log(decoded.name); // `decoded` is an object
// the output will be 'abcde'
Here's the definition of decode
:
decode(buffer: ArrayLike<number> | BufferSource, options?: DecodeOptions): unknown
Easy question.. Thanks