Working with LZip Archives
Contents
[
Hide
Show
]Overview
Lzip archive is common in Linux. It uses LZMA algorithm. Aspose.ZIP for .NET API lets work with creating and managing Lzip archives in your applications without the need of any other 3rd party applications. Aspose.ZIP API provides LzipArchive class to work with such archives. This class provides basic methods to perform operations on archives.
Compress A File
The following code example shows how to compress a file using LzipArchive instance.
1 using (LzipArchive archive = new LzipArchive())
2 {
3 archive.SetSource("data.bin");
4 archive.Save("data.bin.lz");
5 }
Extract Lzip Archive
The following simple code example shows how to open a Lzip archive.
1 using (FileStream sourceLzipFile = File.Open("data.bin.lz", FileMode.Open))
2 {
3 using (FileStream extractedFile = File.Open("data.bin", FileMode.Create))
4 {
5 using (LzipArchive archive = new LzipArchive(sourceLzipFile))
6 {
7 archive.Extract(extractedFile);
8 }
9 }
10 }