devexpress/agent-skills/devexpress-office-file-api-zip

Claude Code and agent skill by devexpress/agent-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Build .NET applications with the DevExpress Zip Compression and Archive API for creating, reading, and extracting ZIP archives programmatically. Use when creating zip files, extracting archives, compressing files or streams, adding password protection to archives, compressing byte arrays or .NET streams, or handling file conflicts during extraction. Also use when someone mentions "DevExpress Zip", "DevExpress Compression", "ZipArchive", "DevExpress.Compression", "create zip C#", "extract zip .NET", "compress stream", or asks about ZIP/archive operations with DevExpress. Covers both .NET and .NET Framework.

Install

npx vskill@latest install devexpress/agent-skills/devexpress-office-file-api-zip

SKILL.md

DevExpress Zip Compression and Archive API

The Zip Compression and Archive API is a non-visual .NET library for creating, reading, and extracting ZIP archives programmatically — without any external dependencies. It supports archiving files, directories, streams, byte arrays, and text; password-protecting entries with AES-256 or ZipCrypto; filtering content during archiving; cancellation via progress callbacks; and conflict resolution during extraction.

When to Use This Skill

Use this skill when you need to:

  • Create a ZIP archive from a directory (recursively) or from a list of files
  • Add individual files to a new or existing ZIP archive
  • Filter files during archiving using the ItemAdding event
  • Archive a .NET Stream or a byte[] directly (without writing to disk first)
  • Archive a text string as a named entry in a ZIP file
  • Password-protect archive entries using AES-256 (EncryptionType.Aes256) or ZipCrypto (EncryptionType.PkZip)
  • Add comments to individual archive entries
  • Extract (unzip) an archive to a directory
  • Resolve file conflicts during extraction with a callback (AllowFileOverwrite event)
  • Cancel a long-running archiving operation via the Progress event
  • Handle archiving errors without aborting the entire operation
  • Add files to an existing archive without losing its current contents

Prerequisites & Installation

NuGet Packages
PackagePurpose
DevExpress.Document.ProcessorCore ZIP compression and archive functionality
.NET (8/9/10+)
bash
dotnet add package DevExpress.Document.Processor
.NET Framework (4.6.2+)
Install-Package DevExpress.Document.Processor

Or add a reference to DevExpress.Docs.v26.1.dll directly.

Important: All DevExpress packages in a project must share the same version number. A valid DevExpress license is required.

Package Versions

Unless the user explicitly requests a specific version, always target the latest DevExpress release (v26.1 at the time of writing). dotnet add package <PackageName> without --version installs the latest stable version — prefer this form. Never pin an older version in project files, Dockerfiles, or CI/CD pipelines unless the user asks for it. This is especially important in integration scenarios (Docker, cloud deployments). All DevExpress.* packages in a project must share the same version.

Before You Start — Ask the Developer

If the host agent has a structured question-asking tool available, use it to ask these questions one at a time with clear options — for example, Claude Code's AskUserQuestion tool or GitHub Copilot's askQuestions tool. If no such tool is available, ask the questions directly in the chat response before generating code.

Before generating code, ask these questions to avoid rework:

General Questions
  1. Target framework: Are you using .NET 8+ or .NET Framework 4.x?
  2. New or existing project?: Creating new or adding to existing?
  3. Hosting model: Console app, ASP.NET Core, Blazor, MAUI, or something else?
Zip-Specific Questions
  1. Operation? Create archive / extract archive / compress stream or byte array / add to existing archive
  2. Source? Directory / specific files with filtering / in-memory stream or byte array
  3. Special requirements? Password protection / file conflict resolution / cancellation / comments
Rule: If the developer's answer is ambiguous or missing, ask before generating code. Do not guess.

Component Overview

The Zip Compression and Archive API provides:

  • Archive creation: Create ZIP archives from directories, file lists, streams, byte arrays, or text (ZipArchive, ZipFileItem, ZipDirectoryItem, ZipStreamItem, ZipByteArrayItem, ZipTextItem)
  • Archive reading and extraction: Open existing ZIP files and extract items to disk (ZipArchive.Read(), ZipItem.Extract())
  • Password protection: Encrypt entries with AES-256 or ZipCrypto (ZipArchive.Password, ZipArchive.EncryptionType, EncryptionType)
  • Event-driven control: Filter items, track progress, resolve conflicts, handle errors (ItemAdding, Progress, AllowFileOverwrite, Error events)
  • In-place update: Update an existing archive without losing its contents (ZipArchive.Read() + AddFile()/UpdateFile())
Core Entry Point
csharp
using DevExpress.Compression;
// Create a new archive from a directory
using (ZipArchive archive = new ZipArchive())
{
archive.AddDirectory(@"C:\MyFiles");
archive.Save("output.zip");
}
// Read and extract an existing archive
using (ZipArchive archive = ZipArchive.Read("output.zip"))
{
foreach (ZipItem item in archive)
item.Extract(@"C:\Extracted");
}

Documentation & Navigation Guide

Getting Started

Refer to references/getting-started.md

When you need to:

  • Set up the Zip API for the first time (NuGet, .NET Framework references)
  • Create your first ZIP archive from a directory
  • Extract an archive to a folder
  • See complete compilable examples for both operations
  • Apply SecureZipPolicy.ResourceLimits to protect against untrusted ZIP files (v26.1+)

Quick Start Example

A complete minimal example — archive two in-memory text files, then extract the result:

csharp
using DevExpress.Compression;
using System.Text;
// --- Part 1: Create archive ---
string zipPath = "example.zip";
using (ZipArchive archive = new ZipArchive())
{
archive.AddText("hello.txt", "Hello from DevExpress Zip API!");
archive.AddText("readme.txt", "This archive was created programmatically.");
archive.Save(zipPath);
}
Console.WriteLine($"Archive created: {zipPath}");
// --- Part 2: Extract archive ---
string extractDir = "extracted";
Directory.CreateDirectory(extractDir);
using (ZipArchive archive = ZipArchive.Read(zipPath))
{
foreach (ZipItem item in archive)
item.Extract(extractDir);
}
Console.WriteLine($"Extracted to: {extractDir}");
What This Does

Creates a ZIP file containing two text entries generated entirely in memory, then extracts both files to the extracted/ subdirectory. No intermediate files are needed for the source content.

Key Properties & API Surface

ZipArchive
Property/MethodTypeDescription
new ZipArchive()—Creates an empty archive ready to receive items
ZipArchive.Read(path)ZipArchiveOpens an existing ZIP file for reading/extraction
ZipArchive.Read(stream, encoding, leaveOpen)ZipArchiveOpens a ZIP from a stream (use to add to existing archive)
AddDirectory(path)ZipDirectoryItemRecursively adds all files in a directory
AddFile(filePath, folderInZip)ZipFileItemAdds a single file to a specified folder in the archive
AddFiles(paths)voidAdds a collection of file paths at once
AddStream(name, stream)ZipStreamItemAdds a .NET stream as a named entry
AddByteArray(name, bytes)ZipByteArrayItemAdds a byte array as a named entry
AddText(name, text)ZipTextItemAdds a UTF-8 text string as a named file entry
Save(filePath)voidCompresses and saves the archive to a file
Save(stream)voidCompresses and saves the archive to a stream
PasswordstringSets the password for encryption
EncryptionTypeEncryptionTypeAes256 (strong) or PkZip (ZipCrypto, legacy)
OptionsBehaviorZipArchiveOptionsBehaviorBehavior settings (e.g., AllowFileOverwrite mode)
ItemAddingeventFires before each item is added; set Action to skip/stop
ProgresseventFires during save; set CanContinue = false to cancel
AllowFileOverwriteeventFires on extraction conflict; set Cancel = true to skip
ErroreventFires on item-level error; set CanContinue = false to abort
ZipItem (base for all item types)
Property/MethodTypeDescription
NamestringEntry name within the archive
CommentstringPer-entry comment string
LastWriteTimeDateTimeLast modified timestamp
CreationTimeDateTimeCreation timestamp
Extract(targetDir)voidExtracts this item to the specified directory
EncryptionType enum
ValueDescription
EncryptionType.Aes256AES-256 encryption (strong, recommended)
EncryptionType.PkZipTraditional ZipCrypto (legacy compatibility)

Common Patterns

Archive a Directory
csharp
using DevExpress.Compression;
using (ZipArchive archive = new ZipArchive())
{
archive.AddDirectory(@"C:\MyDocuments");
archive.Save("documents.zip");
}
Archive Selected Files (filtered by extension)
csharp
using DevExpress.Compression;
string[] files = Directory.GetFiles(@"C:\MyDocuments", "*.*", SearchOption.AllDirectories);
string[] allowed = { ".txt", ".docx" };
using (ZipArchive archive = new ZipArchive())
{
foreach (string file in files)
{
if (allowed.Contains(Path.GetExtension(file)))
archive.AddFile(file, "/");
}
archive.Save("selected.zip");
}
Add Files via ItemAdding Event (conditional filtering)
csharp
using DevExpress.Compression;
using (ZipArchive archive = new ZipArchive())
{
archive.ItemAdding += (sender, args) =>
{
// Skip files not modified today
if (args.Item.CreationTime.Date != DateTime.Today)
args.Action = ZipItemAddingAction.Cancel;
};
archive.AddDirectory(@"C:\MyFiles");
archive.Save("filtered.zip");
}
Add File to an Existing Archive
csharp
using DevExpress.Compression;
string zipPath = "existing.zip";
using (MemoryStream ms = new MemoryStream())
{
using (FileStream fs = File.Open(zipPath, FileMode.Open))
fs.CopyTo(ms);
ms.Seek(0, SeekOrigin.Begin);
using (ZipArchive archive = ZipArchive.Read(ms, System.Text.Encoding.Default, false))
{
archive.AddFile(@"C:\NewFile.txt", "/");
archive.Save(zipPath);
}
}
Password-Protect an Archive (AES-256)
csharp
using DevExpress.Compression;
using (ZipArchive archive = new ZipArchive())
{
archive.Password = "s3cur3P@ssword";
archive.EncryptionType = EncryptionType.Aes256;
archive.AddDirectory(@"C:\Sensitive");
archive.Save("protected.zip");
}
Compress a .NET Stream
csharp
using DevExpress.Compression;
byte[] data = System.Text.Encoding.UTF8.GetBytes("Content to compress");
using (Stream inputStream = new MemoryStream(data))
using (Stream outputStream = new FileStream("stream.zip", FileMode.Create))
using (ZipArchive archive = new ZipArchive())
{
archive.AddStream("data.bin", inputStream);
archive.Save(outputStream);
}
Compress a Byte Array
csharp
using DevExpress.Compression;
byte[] payload = Enumerable.Repeat((byte)0x78, 10000).ToArray();
using (Stream outputStream = new FileStream("bytes.zip", FileMode.Create))
using (ZipArchive archive = new ZipArchive())
{
archive.AddByteArray("payload.bin", payload);
archive.Save(outputStream);
}
Add a Text String Directly
csharp
using DevExpress.Compression;
using (ZipArchive archive = new ZipArchive())
{
archive.AddText("notes.txt", "Hello, this is stored as UTF-8 text.");
archive.Save("text.zip");
}
Add Per-Entry Comments
csharp
using DevExpress.Compression;
using (ZipArchive archive = new ZipArchive())
{
foreach (string file in Directory.EnumerateFiles(@"C:\MyFiles"))
{
ZipFileItem item = archive.AddFile(file, "/");
item.Comment = $"Archived by {Environment.UserName} on {DateTime.Today:yyyy-MM-dd}";
}
archive.Save("commented.zip");
}
Cancel Archiving via Progress Event
csharp
using DevExpress.Compression;

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
52
Repository forks
8
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/devexpress/agent-skills/devexpress-office-file-api-zip/badge)](https://verified-skill.com/skills/devexpress/agent-skills/devexpress-office-file-api-zip)

Something wrong with this skill or its page? Tell us.