I have data which is encoded as LZ4 HC. I want to encode that data and make it to an string.
I found the Library "K4os.Compression.LZ4" on Github and tried to decompress it with the following code which is meantioned in the last comment here -> Encode and Decode Byte Array using Lz4net:
byte[] compressedData = File.ReadAllBytes($"{FilePath}{originalFileName}");
int uncompressedSize = 128000; // should be ~ that size afterwards
byte[] uncompressedData = new byte[uncompressedSize];
byte[] decodedfileData = LZ4.LZ4Codec.Decode(
compressedData,
0, // offset for magic number
uncompressedSize,
compressedData.Length);
When running the code, I get the following error message: "inputOffset and inputLength are invalid for given input"
I also mentioned in the code, that I absolutly dont know the exact size of the uncompressed data. How do I find that out? Thanks!