.. Copyright 2019 RoadrunnerWMC This file is part of ndspy. ndspy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ndspy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ndspy. If not, see . ``ndspy.lz10``: LZ10 Compression ================================ .. py:module:: ndspy.lz10 ``ndspy.lz10`` provides functions for compression and decompression in the *LZ10* compression format used in some games. .. seealso:: This module also includes a :doc:`command-line interface <../cli/lz10>`. .. py:function:: compress(data) Compress data in *LZ10* format. This is the inverse of :py:func:`decompress`. :param bytes data: The data to compress. :returns: The compressed data. :rtype: :py:class:`bytes` .. py:function:: compressFromFile(filePath) Load a filesystem file, and compress its contents. This is the inverse of :py:func:`decompressToFile`, and is a convenience function. :param filePath: The path to the file to open. :type filePath: :py:class:`str` or other path-like object :returns: The compressed data. :rtype: :py:class:`bytes` .. py:function:: compressToFile(data, filePath) Compress data in *LZ10* format, and save it to a filesystem file. This is the inverse of :py:func:`decompressFromFile`, and is a convenience function. :param bytes data: The data to compress. :param filePath: The path to the compressed file to save to. :type filePath: :py:class:`str` or other path-like object .. py:function:: decompress(data) Decompress data that was compressed using *LZ10*. This is the inverse of :py:func:`compress`. :param bytes data: The compressed data. :returns: The decompressed data. :rtype: :py:class:`bytes` .. py:function:: decompressFromFile(filePath) Load a *LZ10*-compressed filesystem file, and decompress it. This is the inverse of :py:func:`compressToFile`, and is a convenience function. :param filePath: The path to the compressed file to open. :type filePath: :py:class:`str` or other path-like object :returns: The decompressed data. :rtype: :py:class:`bytes` .. py:function:: decompressToFile(data, filePath) Decompress data that was compressed using *LZ10*, and save it to a filesystem file. This is the inverse of :py:func:`compressFromFile`, and is a convenience function. :param bytes data: The data to decompress. :param filePath: The path to the file to save to. :type filePath: :py:class:`str` or other path-like object .. py:function:: main([args]) This is the main function for :doc:`this module's command-line interface <../cli/lz10>`. This allows you to invoke the CLI programmatically, if you would like. :param args: The command-line arguments. Defaults to ``sys.argv`` if not provided. :type args: :py:class:`list` of :py:class:`str`