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

Buffer.prototype.slice not working #72

Open
dvdmor opened this issue Feb 22, 2019 · 2 comments
Open

Buffer.prototype.slice not working #72

dvdmor opened this issue Feb 22, 2019 · 2 comments

Comments

@dvdmor
Copy link

dvdmor commented Feb 22, 2019

Hey,

I'm trying to run a simple example:

var Buffer = require('buffer').Buffer';
var LZ4 = require('lz4');
var input = new Buffer(itemToCompress);
var output = new Buffer( LZ4.encodeBound(input.length) );
var compressedSize = LZ4.encodeBlock(input, output);
output = output.slice(0, compressedSize);

input buffer size is 66293, compressedSize is 8002, and output buffer is 66568.
However, slice doesn't seem to do anything to the buffer, and returns a buffer of the same size.

Am I missing something?
Thanks!

@pierrec
Copy link
Owner

pierrec commented May 8, 2019

I cannot see the behaviour that you describe: the output buffer gets correctly resized according to the compressed size.
Could you post a fully reproducible example?

@mesvam
Copy link

mesvam commented Apr 2, 2020

Update to the latest version. #83 seems to be the same problem and has been fixed

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

3 participants