README.md#record-structure-extension-definition example doesn't work
xBZZZZ opened this issue · comments
README.md#record-structure-extension-definition says:
but example doesn't work:+--------+--------+--------+~~~~~~~~~~~~~~~~~~~~~~~~~+--------+--------+--------+ | 0xd4 | 0x72 | 0x40 | array: [ "foo", "bar" ] | 0x40 | 0x04 | 0x02 | +--------+--------+--------+~~~~~~~~~~~~~~~~~~~~~~~~~+--------+--------+--------+
Which should generate an object that would correspond to JSON:
{ "foo": 4, "bar": 2}
//this is in node.js
var m=require("msgpackr");
m.unpack(Buffer.of(0xD4,0x72,0x40,...m.pack(["foo","bar"]),0x40,0x04,0x02));
throws Uncaught Error: Unexpected end of MessagePack data
but if you remove second
0x40
it works:
//this is in node.js
var m=require("msgpackr");
m.unpack(Buffer.of(0xD4,0x72,0x40,...m.pack(["foo","bar"]),/*0x40, REMOVED*/0x04,0x02));
You are correct, thank you for pointing this!