node_erlastic
node_erlastic copied to clipboard
Compressed binary support
Getting error: Unexpected BERT type: 80
when trying to decode. I am using: Compressed Term Format
The first byte after 131 is "80"
Fix was very non-intutive:
const { unzip } = require('node:zlib');
const { promisify } = require('node:util');
const do_unzip = promisify(unzip);
//remove the first 6 bytes and inflate using zlib
const inflated = await do_unzip(buffer.subarray(6));
//we are skipping check for 131 in decode function rest of logic in decode function is the same
var Obj = Bert.decode_inner(inflated);
if (Obj.rest.length !== 0) {
throw ("Invalid BERT.");
}
return Obj.value;
Hi, thanks for the inputs, I don't have the time to look further into it yet, but I'll come back to it as soon as possible.