dissect.util.compression.lz4

Module Contents

Functions

decompress

LZ4 decompress from a file-like object up to a certain length. Assumes no header.

dissect.util.compression.lz4.decompress(src: bytes | BinaryIO, uncompressed_size: int = -1, max_length: int = -1, return_bytearray: bool = False, return_bytes_read: bool = False) bytes | tuple[bytes, int]

LZ4 decompress from a file-like object up to a certain length. Assumes no header.

Parameters:
  • src – File-like object to decompress from.

  • uncompressed_size – Ignored, present for compatibility with native lz4. The max_length parameter sort-of but not completely has the same function.

  • max_length – Decompress up to this many result bytes.

  • return_bytearray – Whether to return bytearray or bytes.

  • return_bytes_read – Whether to return a tuple of (data, bytes_read) or just the data.

Returns:

The decompressed data or a tuple of the decompressed data and the amount of bytes read.