Introducción a IronZIP
IronZIP: Su biblioteca de archivos todo en uno para .NET
IronZIP es una biblioteca de compresión y descompresión de archivos desarrollada por Iron Software. Además del formato ZIP ampliamente usado, también puede manejar TAR, GZIP y BZIP2.
Biblioteca de compresión y descompresión de archivos de C
- Descarga la biblioteca C# para compresión y descompresión de archivos
- Maneja formatos ZIP, TAR, GZIP y BZIP2
- Personaliza niveles de compresión del 0 al 9
- Extrae contenido de archivos comprimidos
- Agrega archivos a archivos ZIP existentes y genera nuevos archivos ZIP
Compatibilidad
IronZIP tiene compatibilidad con soporte multiplataforma con:
Compatibilidad con versiones .NET:
- C#, VB.NET, F#
- .NET 7, 6, 5, y Core 3.1+
- .NET Standard (2.0+)
- .NET Framework (4.6.2+)
Soporte de sistemas operativos y entornos:
- Windows (10+, Server 2016+)
- Linux (Ubuntu, Debian, CentOS, etc.)
- macOS (10+)
- iOS (12+)
- API Android 21+ (v5 "Lollipop")
- Docker (Windows, Linux, Azure)
- Azure (VPS, WebApp, Function)
- AWS (EC2, Lambda)
Compatibilidad con tipos de proyectos .NET:
- Web (Blazor & WebForms)
- Móvil (Xamarin & MAUI)
- Escritorio (WPF & MAUI)
- Consola (Aplicación y Biblioteca)
Instalación
Biblioteca IronZIP
Para instalar el paquete IronZIP, utiliza el siguiente comando en tu terminal o consola del administrador de paquetes:
Install-Package IronZip
Alternativamente, descárgalo directamente desde el sitio oficial de NuGet de IronZIP.
Una vez instalado, puedes comenzar agregando using IronZip; al principio de tu código C#.
Aplicar clave de licencia
A continuación, aplica una licencia válida o una clave de prueba a IronZIP asignando la clave de licencia a la propiedad LicenseKey de la clase License. Incluye el siguiente código justo después de la declaración de importación, antes de usar cualquier método de IronZIP:
using IronZip;
// Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY";using IronZip;
// Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY";Ejemplos de código
Crear un ejemplo de archivo
Crea un archivo ZIP usando la declaración using. Dentro del bloque using, usa el método AddArchiveEntry para importar archivos al archivo ZIP. Finalmente, exporta el archivo ZIP con el método SaveAs.
using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Create a new ZIP file
using (var archive = new ZipArchive())
{
// Add a file to the archive
archive.AddArchiveEntry("example.txt", File.ReadAllBytes("path/to/example.txt"));
// Save the ZIP archive
archive.SaveAs("archive.zip");
}
}
}using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Create a new ZIP file
using (var archive = new ZipArchive())
{
// Add a file to the archive
archive.AddArchiveEntry("example.txt", File.ReadAllBytes("path/to/example.txt"));
// Save the ZIP archive
archive.SaveAs("archive.zip");
}
}
}Desarchivar un archivo en una carpeta
Extrae el contenido del archivo ZIP usando el método ExtractArchiveToDirectory. Especifica la ruta del archivo ZIP de destino y el directorio de extracción.
using IronZip;
class Program
{
static void Main()
{
// path to the ZIP file and extraction directory
string zipPath = "archive.zip";
string extractPath = "extracted/";
// Extract all files in the ZIP archive to the specified directory
using (var archive = new ZipArchive(zipPath))
{
archive.ExtractArchiveToDirectory(extractPath);
}
}
}using IronZip;
class Program
{
static void Main()
{
// path to the ZIP file and extraction directory
string zipPath = "archive.zip";
string extractPath = "extracted/";
// Extract all files in the ZIP archive to the specified directory
using (var archive = new ZipArchive(zipPath))
{
archive.ExtractArchiveToDirectory(extractPath);
}
}
}Agregar archivos a un archivo existente
Pasar la ruta del archivo ZIP al constructor abrirá el archivo ZIP. Utiliza el mismo método AddArchiveEntry para agregar archivos al ZIP abierto y expórtalo con el método SaveAs.
using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Open an existing ZIP file
using (var archive = new ZipArchive("archive.zip"))
{
// Add more files to the archive
archive.AddArchiveEntry("anotherfile.txt", File.ReadAllBytes("path/to/anotherfile.txt"));
// Save updates to the ZIP archive
archive.SaveAs("archive.zip");
}
}
}using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Open an existing ZIP file
using (var archive = new ZipArchive("archive.zip"))
{
// Add more files to the archive
archive.AddArchiveEntry("anotherfile.txt", File.ReadAllBytes("path/to/anotherfile.txt"));
// Save updates to the ZIP archive
archive.SaveAs("archive.zip");
}
}
}Licencias y soporte disponibles
IronZIP es una biblioteca de pago, sin embargo, las licencias de prueba gratuitas también están disponibles aquí.
Para más información sobre Iron Software, por favor visita nuestro sitio web: https://ironsoftware.com/ Para más asistencia y consultas, por favor pregunta a nuestro equipo.
Soporte de Iron Software
Para soporte general y consultas técnicas, por favor envíanos un correo electrónico a: support@ironsoftware.com





