ndspy.lz10: LZ10 Compression

ndspy.lz10 provides functions for compression and decompression in the LZ10 compression format used in some games.

See also

This module also includes a command-line interface.

ndspy.lz10.compress(data)[source]

Compress data in LZ10 format. This is the inverse of decompress().

Parameters:data (bytes) – The data to compress.
Returns:The compressed data.
Return type:bytes
ndspy.lz10.compressFromFile(filePath)[source]

Load a filesystem file, and compress its contents. This is the inverse of decompressToFile(), and is a convenience function.

Parameters:filePath (str or other path-like object) – The path to the file to open.
Returns:The compressed data.
Return type:bytes
ndspy.lz10.compressToFile(data, filePath)[source]

Compress data in LZ10 format, and save it to a filesystem file. This is the inverse of decompressFromFile(), and is a convenience function.

Parameters:
  • data (bytes) – The data to compress.
  • filePath (str or other path-like object) – The path to the compressed file to save to.
ndspy.lz10.decompress(data)[source]

Decompress data that was compressed using LZ10. This is the inverse of compress().

Parameters:data (bytes) – The compressed data.
Returns:The decompressed data.
Return type:bytes
ndspy.lz10.decompressFromFile(filePath)[source]

Load a LZ10-compressed filesystem file, and decompress it. This is the inverse of compressToFile(), and is a convenience function.

Parameters:filePath (str or other path-like object) – The path to the compressed file to open.
Returns:The decompressed data.
Return type:bytes
ndspy.lz10.decompressToFile(data, filePath)[source]

Decompress data that was compressed using LZ10, and save it to a filesystem file. This is the inverse of compressFromFile(), and is a convenience function.

Parameters:
  • data (bytes) – The data to decompress.
  • filePath (str or other path-like object) – The path to the file to save to.
ndspy.lz10.main([args])[source]

This is the main function for this module’s command-line interface. This allows you to invoke the CLI programmatically, if you would like.

Parameters:args (list of str) – The command-line arguments. Defaults to sys.argv if not provided.