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

Decompressing Blocks w/ Invalid Returned Size #89

Open
ghost opened this issue Nov 16, 2019 · 0 comments
Open

Decompressing Blocks w/ Invalid Returned Size #89

ghost opened this issue Nov 16, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 16, 2019

Hello,
I just started using the library and can almost get it to work correctly. I have LZ4 blocks coming in as Base64 strings and I decode them with:
data = new Buffer(input,'base64');
var output = new Buffer(data.length*10);
var size = lz4.decodeBlock(data,output);

The returned 'size' is < 0 so there seems to be an error, but when I dump the results of 'output' to the console part of the original data is there properly decompressed. So it seems to be doing something right. Increasing the size of the buffer gets closer to showing the desired output, but is missing the last few characters. ('size' still < 0)

If I change the code to:
var output = new Buffer(data.length*100);
var size = lz4.decodeBlock(data,output,0,data.length*100);

I see the entire decompressed data, but also some extra garbage characters at the end of the output. 'size' still < 0. I tried multiple variations of the different properties and tried running the same data through a different .NET LZ4 library and it works as expected. I also tried using the 'size' in different ways with slice, but no luck in trimming the trailing characters.

Any ideas on what might be happening here? Feels like I'm missing something simple.

Thanks in advance for any help.

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

0 participants