![]() |
VOOZH | about |
dotnet add package Gapotchenko.FX.Data.Archives.Zip --version 2026.7.2
NuGet\Install-Package Gapotchenko.FX.Data.Archives.Zip -Version 2026.7.2
<PackageReference Include="Gapotchenko.FX.Data.Archives.Zip" Version="2026.7.2" />
<PackageVersion Include="Gapotchenko.FX.Data.Archives.Zip" Version="2026.7.2" />Directory.Packages.props
<PackageReference Include="Gapotchenko.FX.Data.Archives.Zip" />Project file
paket add Gapotchenko.FX.Data.Archives.Zip --version 2026.7.2
#r "nuget: Gapotchenko.FX.Data.Archives.Zip, 2026.7.2"
#:package Gapotchenko.FX.Data.Archives.Zip@2026.7.2
#addin nuget:?package=Gapotchenko.FX.Data.Archives.Zip&version=2026.7.2Install as a Cake Addin
#tool nuget:?package=Gapotchenko.FX.Data.Archives.Zip&version=2026.7.2Install as a Cake Tool
The module provides ZIP archive functionality that integrates with the virtual file system (VFS) abstraction layer, allowing you to treat ZIP archives as file systems.
ZipArchive class from Gapotchenko.FX.Data.Archives.Zip module represents a ZIP archive and implements IFileSystemView, which means you can use it just like a regular file system.
You can create a new ZIP archive:
using Gapotchenko.FX.Data.Archives.Zip;
using Gapotchenko.FX.IO.Vfs;
// Create a new writable ZIP archive
using var zip = ZipArchive.Storage.CreateFile("archive.zip");
// Now you can use it as a file system
zip.WriteAllText("readme.txt", "Hello from ZIP archive!");
Reading from a ZIP archive is straightforward:
using Gapotchenko.FX.Data.Archives.Zip;
using Gapotchenko.FX.IO.Vfs;
// Open an existing ZIP archive for reading
using var zip = ZipArchive.Storage.ReadFile("archive.zip");
// Check if a file exists
if (zip.FileExists("readme.txt"))
{
// Read file content
string content = zip.ReadAllText("readme.txt");
Console.WriteLine(content);
}
Since ZipArchive implements IFileSystemView, you can use all the typical file operations:
using Gapotchenko.FX.Data.Archives.Zip;
using Gapotchenko.FX.IO.Vfs;
using var zip = ZipArchive.Storage.OpenFile("archive.zip", FileMode.OpenOrCreate);
// Write text to a file
zip.WriteAllText("data.txt", "Some content");
// Read all lines
string[] lines = zip.ReadAllLines("data.txt");
// Copy a file
zip.CopyFile("data.txt", "backup.txt", overwrite: true);
// Delete a file
zip.DeleteFile("old.txt");
You can enumerate files and directories in a ZIP archive:
using Gapotchenko.FX.Data.Archives.Zip;
using System.IO;
using var zip = ZipArchive.Storage.ReadFile("archive.zip");
// Enumerate all files
foreach (string file in zip.EnumerateFiles("/"))
Console.WriteLine(file);
// Enumerate files with a pattern
foreach (string file in zip.EnumerateFiles("/", "*.txt"))
Console.WriteLine(file);
// Enumerate directories
foreach (string dir in zip.EnumerateDirectories("/"))
Console.WriteLine(dir);
Directory operations are also supported:
using Gapotchenko.FX.Data.Archives.Zip;
using System.IO;
using var zip = ZipArchive.Storage.CreateFile("archive.zip");
// Create a directory structure
zip.CreateDirectory("folder1/subfolder");
// Write files to directories
zip.WriteAllText("folder1/file.txt", "Content");
// Check if directory exists
if (zip.DirectoryExists("folder1"))
{
// Enumerate files in directory
foreach (string file in zip.EnumerateFiles("folder1"))
Console.WriteLine(file);
}
You can control whether the underlying stream should remain open after disposing the archive:
using Gapotchenko.FX.Data.Archives.Zip;
using System.IO;
var stream = new FileStream("archive.zip", FileMode.Create);
// Leave the stream open after disposing the archive
using (var zip = new ZipArchive(stream, writable: true, leaveOpen: true))
zip.WriteAllText("file.txt", "Content");
// Archive is disposed, but stream remains open
// ... stream can be used further
ZipArchive exposes capabilities that indicate what operations are supported:
using Gapotchenko.FX.Data.Archives.Zip;
using System.IO;
using var stream = new FileStream("archive.zip", FileMode.Open);
using var zip = new ZipArchive(stream, writable: false);
Console.WriteLine($"Can read: {zip.CanRead}");
Console.WriteLine($"Can write: {zip.CanWrite}");
Console.WriteLine($"Supports last write time: {zip.SupportsLastWriteTime}");
Since ZipArchive implements IFileSystemView, it can be used anywhere a file system view is expected. This allows you to write code that works with both regular file systems and ZIP archives:
using Gapotchenko.FX.Data.Archives.Zip;
using Gapotchenko.FX.IO.Vfs;
// Works with local file system
ProcessFiles(FileSystemView.Local);
// Also works with ZIP archive
using (var zip = ZipArchive.Storage.ReadFile("archive.zip"))
{
ProcessFiles(zip);
// Works with a nested archive as well
using (var nestedZip = ZipArchive.Storage.ReadFile(new VfsLocation(zip, "nested.zip"))
ProcessFiles(nestedZip);
}
void ProcessFiles(IReadOnlyFileSystemView vfs)
{
if (vfs.FileExists("data.txt"))
{
string content = vfs.ReadAllText("data.txt");
// Process content...
}
}
Let's continue with a look at some other modules provided by Gapotchenko.FX:
Or look at the full list of modules.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.7.2 | 101 | 5/16/2026 |
| 2026.6.2 | 130 | 3/29/2026 |
| 2026.5.3 | 117 | 2/24/2026 |
| 2026.4.2 | 129 | 2/4/2026 |
| 2026.3.5 | 119 | 1/29/2026 |
| 2026.2.2 | 124 | 1/25/2026 |
| 2026.1.5 | 138 | 1/13/2026 |
| 2025.1.45 | 205 | 12/25/2025 |
| 2025.1.27-beta | 217 | 10/8/2025 |
| 2025.1.26-beta | 275 | 8/30/2025 |
| 2025.1.25-beta | 932 | 7/22/2025 |
| 2025.1.24-beta | 418 | 7/16/2025 |
| 2025.1.23-beta | 301 | 7/12/2025 |