- Documentation
Torch Log Service
User Guide
Data consumption and shipping
Ship logs to TOS
Decompress Snappy-compressed files
Ship logs to TOS
Decompress Snappy-compressed files
Decompress Snappy-compressed files
TLS automatically applies Snappy to compress TOS files when shipping logs to TOS. After logs are shipped successfully, you can decompress TOS files using language programing tools like C++, Java, Python, and Go etc.
Decompress using the C++ Library
- Download and install dependencies.
- Manual installation method
Notice
Manually installed libraries may not be recognized by the system automatically. You need to add the library path manually.
Decompress files using Java Lib
- Download the dependencies.
Description
We recommend using Java Lib version 1.1.2.6 or above. Version 1.1.2.1 has a bug that may prevent some compressed files from being extracted. However, versions 1.1.2.6 and above have resolved this issue. For more information about this bug, see bad handling of the MAGIC HEADER. - The code example is as follows:
Decompress files using Python Lib
- The python3 code example is as follows:
Notice
- If you encounter errors while using snappy.uncompress on Windows, such as UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 0: illegal multibyte sequence, it may be caused by the Windows file system starting files with BOM. We recommend using a Unix-like system or setting the correct file encoding in the encoding parameter of the open function.
- In command-line scenarios, only Hadoop mode (hadoop_stream_decompress) and stream mode (stream_decompress) are supported. Snappy-compressed files can not be extracted using the following command-line tool: python -m snappy -d compressed_file.snappy uncompressed_file.
- The code example is as follows:
Last updated: 2026.04.24 16:25:19