Getting Started with IronZip

IronZip: Your All-in-One Archive Library for .NET

IronZip is an archive compression and decompression library developed by Iron Software. In addition to the widely used ZIP format, it can also handle TAR, GZIP, and BZIP2.

Compatibility

IronZip has cross platform support compatibility with:

.NET Version Support:

  • C#, VB.NET, F#
  • .NET 7, 6, 5, and Core 3.1+
  • .NET Standard (2.0+)
  • .NET Framework (4.6.2+)

Operating Systems and Environments Support:

  • Windows (10+, Server 2018+)
  • Linux (Ubuntu, Debian, CentOS, etc.)
  • macOS (10+)
  • iOS (12+)
  • Android API 21+ (v5 “Lollipop”)
  • Docker (Windows, Linux, Azure)
  • Azure (VPS, WebApp, Function)
  • AWS (EC2, Lambda)

.NET Project Types Support:

  • Web (Blazor & WebForms)
  • Mobile (Xamarin & MAUI)
  • Desktop (WPF & MAUI)
  • Console (App & Library)

Installation

IronZip Library

Installing the IronZip is quick and easy, please install the package like this:

PM> Install-Package IronZip

Alternatively, download directly from the official IronZip NuGet website.

Once installed, you can get started by adding using IronZip; to the top of your C# code.

Applying License Key

Next, apply a valid license or trial key to IronZip by assigning the license key to the LicenseKey property of License class. Include the following code right after the import statement, before using any IronZip methods:

:path=/static-assets/zip/content-code-examples/get-started/get-started-license.cs
IronZip.Licensing.License.LicenseKey = "IRONZIP.MYLICENSE.KEY.1EF01";
IronZip.Licensing.License.LicenseKey = "IRONZIP.MYLICENSE.KEY.1EF01"
VB   C#

Code Examples

Create an Archive Example

Create a ZIP file using the 'using' statement and specify the output ZIP file name. Then, use the AddArchiveEntry method to import files into the ZIP file.

:path=/static-assets/zip/content-code-examples/get-started/get-started-1.cs
using IronZip;

// Create an empty zip
using (var archive = new IronArchive("output.zip"))
{
    // Add files to the zip
    archive.AddArchiveEntry("./assets/image1.png");
    archive.AddArchiveEntry("./assets/image2.png");
}
Imports IronZip

' Create an empty zip
Using archive = New IronArchive("output.zip")
	' Add files to the zip
	archive.AddArchiveEntry("./assets/image1.png")
	archive.AddArchiveEntry("./assets/image2.png")
End Using
VB   C#

Unarchive an Archive to Folder

Extract the content from the ZIP file using the ExtractArchiveToDirectory method. Specify the path of the target ZIP file and the extraction directory.

:path=/static-assets/zip/content-code-examples/get-started/get-started-2.cs
using IronZip;

// Extract Zip
IronArchive.ExtractArchiveToDirectory("output.zip", "extracted");
Imports IronZip

' Extract Zip
IronArchive.ExtractArchiveToDirectory("output.zip", "extracted")
VB   C#

Add Files to An Existing Archive

Use the FromFile method to open an existing archive. This method also requires specifying the file name of the new archive that will be created as output. Utilize the same AddArchiveEntry method to add files to the existing ZIP.

:path=/static-assets/zip/content-code-examples/get-started/get-started-3.cs
using IronZip;

// Open existing zip and export zip
using (var archive = IronArchive.FromFile("existing.zip", "result.zip"))
{
    // Add files
    archive.AddArchiveEntry("./assets/image3.png");
    archive.AddArchiveEntry("./assets/image4.png");
}
Imports IronZip

' Open existing zip and export zip
Using archive = IronArchive.FromFile("existing.zip", "result.zip")
	' Add files
	archive.AddArchiveEntry("./assets/image3.png")
	archive.AddArchiveEntry("./assets/image4.png")
End Using
VB   C#

Licensing & Support Available

IronZip is a paid library, however free trial licenses are also available here.

For more information about Iron Software please visit our website: https://ironsoftware.com/ For more support and inquiries, please ask our team.

Support from Iron Software

For general support and technical inquiries, please email us at: support@ironsoftware.com