erlpack
erlpack copied to clipboard
Error: Bad version number.
I'm copying the the data directly from messages on the gateway websocket connection in discord dev tools.
const erlpack = require("erlpack");
const str = 'HEXDATA';
const packed = Buffer.from(str, 'hex');
const unpacked = erlpack.unpack(packed);
console.log(unpacked);
[Error ../js/decoder.h:28] Bad version number.
/home/zipdox/Documents/zlibtest/index.js:7
const unpacked = erlpack.unpack(packed);
^
Error: Bad version number.
at Object.<anonymous> (/home/zipdox/Documents/zlibtest/index.js:7:26)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
did you solve the problem?
I think the cause of the problem is that Discord splits the data into several WS messages. I didn't care to try to fix it though.