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 #1

Open
Cidan opened this issue Jun 21, 2015 · 5 comments
Open

compressed binary support #1

Cidan opened this issue Jun 21, 2015 · 5 comments

Comments

@Cidan
Copy link

Cidan commented Jun 21, 2015

Hey,

I have a patch for bert.js that adds compressed binary support, however it requires node.js 0.12 at minimum, due to a bug in the zlib implementation in prior versions.

Is that acceptable, and if so, should I submit a PR?

Thanks!

@awetzel
Copy link
Collaborator

awetzel commented Jun 22, 2015

Hello,
Yes it is OK to require node.js 0.12, my projects actually use io.js on earlier versions, maybe you can also add the requirement to the package.json.

Thank you very much for the proposal, I actually wanted to add this support.

@benoitc
Copy link

benoitc commented Nov 18, 2015

👍

1 similar comment
@matehat
Copy link
Contributor

matehat commented Nov 18, 2015

👍

@harshagarwal00
Copy link

@Cidan : is this done ..
having trouble to decode Compressed Term Format:
Screenshot 2022-07-20 at 11 43 28 AM

@harshagarwal00
Copy link

harshagarwal00 commented Jul 21, 2022

Fix was very non-intuitive

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;

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

5 participants