I run npm install lz4 in my project, and compress a file in node environment. Then, I decompress it in browser. But it works wrong.
I run examples/compress.html and change it a little to get a compressed buffer. And then I run examples/decompress.html, it works.
So, why files compressed with the node version of lz4 cannot be decompressed with the js version of lz4?
What I think is that no matter what lz4 tool is used to compress the file, the compressed file should finally be able to be decompressed.
What's more, I use c/c++ LZ4: https://github.com/lz4/lz4 to decompress these two Buffer. The nodeVersion Buffer can be decompressed by using function LZ4_decompress_safe when the jsVersion can't.
hello everyone! I was confused by this.
npm install lz4
in my project, and compress a file in node environment. Then, I decompress it in browser. But it works wrong.examples/compress.html
and change it a little to get a compressed buffer. And then I runexamples/decompress.html
, it works.So, why files compressed with the node version of lz4 cannot be decompressed with the js version of lz4? What I think is that no matter what lz4 tool is used to compress the file, the compressed file should finally be able to be decompressed.
Below is the node_version & js_version Buffer:
What's more, I use c/c++ LZ4: https://github.com/lz4/lz4 to decompress these two Buffer. The nodeVersion Buffer can be decompressed by using function
LZ4_decompress_safe
when the jsVersion can't.