CSO is a compressed ISO9660 format that is commonly used by PlayStation Portable (PSP) UMD disk images.
This tool provides:
- Command line tool for compressing and decompressing CSO files
- Python module with compression and decompression routines
When using the CLI interface autodetection of the input file takes place to determine if compression or decompression should take place. if the input file is a CSO file it will be decompressed. If it is not a CSO file it will be compressed as CSO. No validation of the input file format (whether it is ISO9660) takes place.
The CLI interface can be run from the top level project source directory. E.g.:
Running from the package directory:
python -m csotools.main_cli file.iso out.cso
If installed on the system using a system package manager or pip
:
csotools file.iso out.cso
Three functions are exposed by the csotools
module:
in_file
will be compressed as CSO and the compressed data will be saved to out_file
.
In file and out file are file type objects. Due to the size of ISO9660 files it is recommended to use file objects and not in memory file like objects.
in_file
will be decompressed from CSO and the uncompressed data will be saved to out_file
.
If in_file
is not a CSO file an exception will be thrown.
In file and out file are file type objects. Due to the size of ISO9660 files it is recommended to use file objects and not in memory file like objects.
Checks whether the given data is a CSO file. This only checks the first 4 bytes are the
CSO file marker. data
should be at least 4 bytes.
from csotools import is_cso
print(is_cso(b'1234'))