Search code examples
c#xz

How to use the 7z SDK to compress and decompress a XZ file


How can I use 7z SDK (http://www.7-zip.org/sdk.html) to compress/decompress a XZ file in C# if the input/output is a file stream?


Solution

  • I researched this problem by myself. In fact, you can't decompress XZ files using 7-Zip SDK for C#.

    From http://www.7-zip.org/sdk.html:

    ANSI-C compatible source code for LZMA / LZMA2 / XZ compression and decompression

    C# source code for LZMA compression and decompression

    There is XZ and LZMA2 decoder source code only for ANSI-C. C# has only LZMA decoder. However you can still decode XZ in C# using third party binaries from xzutils.