erlpack icon indicating copy to clipboard operation
erlpack copied to clipboard

Error: Bad version number.

Open Zipdox opened this issue 2 years ago • 2 comments

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

Zipdox avatar Jun 24 '22 21:06 Zipdox

did you solve the problem?

MahdiAw avatar Sep 16 '22 17:09 MahdiAw

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.

Zipdox avatar Sep 17 '22 00:09 Zipdox