Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants