mcollina/msgpack5

Buffer decode

nitsugahcram opened this issue · 4 comments

Hi, I am receiving a Buffer from net that is encoded with msgpack, but when I tried to decode allways decode first filled.

const msgpack = require('msgpack5')();
var _temp = msgpack.encode(1)
var a = Buffer.from(_temp)
_temp = msgpack.encode("Hi this my test");
a = Buffer.concat([a, _temp], a.length + _temp.length)
<Buffer 01 a4 48 6f 6c 61>
 msgpack.decode(a)
1

How Can I decode all data?
Thanks

That will not work. You need to take care of the message boundaries yourself, e.g. do not concat.

Could you give a hit, to not concat?

Send an array, or add an header with the length of the message
Il giorno ven 11 nov 2016 alle 19:44 Agustin March notifications@github.com
ha scritto:

Could you give a hit, to not concat?


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
#51 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADL47w2q-VBkUpYPhKLkuGxQyIf_un_ks5q9LebgaJpZM4KwAN1
.

thanks, the point others mspack has the next, that retrieve the next field..., just to mention, I could not send the header since this pack is used other system in c, java, python and not require this...