-
Hi, I am migrating from msgpack-node to msgpackr. Packing this object causing different values but unpacking them causes same value.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Yes, when you use the |
Beta Was this translation helpful? Give feedback.
-
Thanks :D, it returns the same value now, except for one input.
|
Beta Was this translation helpful? Give feedback.
-
Hi again, `const msgpack = require('msgpack'); const map = new Map(); let packed = msgpackr.pack(input); console.log(Buffer.compare(packed, old_packed) ? 'non identical' : 'identical'); |
Beta Was this translation helpful? Give feedback.
Yes, when you use the
Packr
constructor to create a encoder/decoder instance vianew Packr
this defaults to enabling the record extension, which for larger objects should be more compact and faster. However, for compatibility with other MessagePack encoders, you should disable that, either usingnew Packr({useRecords: false})
, or directly using the exportedunpack
/pack
(import { pack, unpack } from 'msgpackr'
). For trying to match other libraries byte for byte, you may also want to usenew Packr({useRecords: false, variableMapSize: true})
, to have minimal object header size (slightly slower, but slightly less compact).