node-lz4
node-lz4 copied to clipboard
Buffer.prototype.slice not working
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!
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?
Update to the latest version. #83 seems to be the same problem and has been fixed