Monday, 8 November 2021

Decompressing a content of unknown length with python-lz4

I am trying to decompress a content of unknown size using python-lz4 using the following code

with open("compressed.msgpk", "rb") as f:
    content = f.read()
    if content[0] == 1:
        uncompressed = lz4.block.decompress(content[1:])

but it always fails with

LZ4BlockError: Decompression failed: corrupt input or insufficient space in destination buffer. Error code: 58

I even tried specifying different/bigger sizes as shown here https://python-lz4.readthedocs.io/en/stable/lz4.block.html but nothing worked.

And if it help the content I am trying to decompress is compressed using lz4net c# library using method LZ4Codec.Unwrap(content, 1) https://github.com/MiloszKrajewski/lz4net/blob/201ed085fed299523616bfd08776694cb61ae6b3/src/LZ4/LZ4Codec.cs#L574



from Decompressing a content of unknown length with python-lz4

No comments:

Post a Comment