Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressed binary support #10

Open
harshagarwal00 opened this issue Jul 20, 2022 · 2 comments
Open

Compressed binary support #10

harshagarwal00 opened this issue Jul 20, 2022 · 2 comments

Comments

@harshagarwal00
Copy link

Getting error:
Unexpected BERT type: 80

when trying to decode.
I am using:
Compressed Term Format

The first byte after 131 is "80"

Screenshot 2022-07-20 at 11 43 28 AM

@harshagarwal00
Copy link
Author

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;

@Shakadak
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants