Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer decode #51

Closed
nitsugahcram opened this issue Nov 11, 2016 · 4 comments
Closed

Buffer decode #51

nitsugahcram opened this issue Nov 11, 2016 · 4 comments

Comments

@nitsugahcram
Copy link

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

@mcollina
Copy link
Owner

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

@nitsugahcram
Copy link
Author

Could you give a hit, to not concat?

@mcollina
Copy link
Owner

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
.

@nitsugahcram
Copy link
Author

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants