Converting ZIP to tar.gz
Tar.gz is by far the most widespread compressed archive format in the Linux world while ZIP is the most popular for Windows. If you want to convert a ZIP archive to tar.gz read this article.
Convertation
Aspose.ZIP API provides the SaveGzipped method to compress a tar archive on the fly. We can extract an entry from the ZIP archive to memory without saving it into intermediate storage and pass it into the tar archive right away.
Make sure you have enough virtual memory to keep the content of all entries.
Transfer an Entry
The following code example demonstrates how to extract entries from the ZIP archive and immediately put them to the tar.gz archive. Entries that are directories are skipped, but their files are added respecting relative paths.
1using (Archive source = new Archive("source.zip"))
2{
3 using (TarArchive tar = new TarArchive())
4 {
5 foreach (ArchiveEntry entry in source.Entries)
6 {
7 if (!entry.IsDirectory)
8 {
9 MemoryStream mem = new MemoryStream();
10 entry.Open().CopyTo(mem);
11 tar.CreateEntry(entry.Name, mem);
12 }
13 }
14
15 tar.SaveGzipped("result.tar.gz");
16 }
17}