simple_archive

File archiving with TAR and ZIP support using minizip-ng

v1.0.0 MIT

Overview

simple_archive provides Eiffel applications with file archiving capabilities. SIMPLE_TAR wraps ISE's compression library for TAR archives. SIMPLE_ZIP uses minizip-ng 4.0.10 (May 2025) for modern ZIP support with in-memory operations ideal for XLSX file handling.

Part of the simple_* ecosystem of focused, single-purpose Eiffel libraries with full Design by Contract support.

Quick Start

Installation

Set environment variable and add to your ECF:

-- Set SIMPLE_EIFFEL=D:\prod
<library name="simple_archive" location="$SIMPLE_EIFFEL/simple_archive/simple_archive.ecf"/>

Creating a ZIP Archive

local
    zip: SIMPLE_ZIP
do
    create zip.make

    -- Create archive with in-memory content
    zip.begin_create ("output.zip")
    zip.add_entry_from_string ("path/in/zip.xml", xml_content)
    zip.add_entry_from_string ("another/file.txt", text_content)
    zip.end_create
end

Extracting from ZIP

local
    zip: SIMPLE_ZIP
    content: detachable STRING
do
    create zip.make

    -- Check if valid archive
    if zip.is_valid_archive ("input.zip") then
        -- Extract specific entry
        content := zip.extract_entry ("input.zip", "path/in/zip.xml")

        -- List all entries
        across zip.list_archive ("input.zip") as entry loop
            print (entry)
        end
    end
end

Features

TAR Archives

Create and extract TAR archives via ISE compression library.

ZIP Archives

Create and extract ZIP archives via minizip-ng 4.0.10.

In-Memory Operations

Build archives from string content without temporary files.

Archive Listing

List contents without extraction for inspection.

Design by Contract

Full preconditions, postconditions, and class invariants.

Void Safety

Fully void-safe implementation with proper attached/detachable handling.

API Reference

SIMPLE_ZIP

FeatureDescription
makeCreate ZIP helper
begin_create (path)Start creating new ZIP archive
add_entry_from_string (name, content)Add entry with string content
end_createFinalize and write ZIP file
list_archive (path)List all entries in archive
extract_entry (path, name)Extract entry content as string
archive_contains (path, name)Check if archive contains entry
is_valid_archive (path)Check if file is valid ZIP
has_errorCheck if last operation failed
last_errorError message from last operation

SIMPLE_TAR

FeatureDescription
create_archive (path, files)Create TAR from files
extract_archive (path, dest)Extract TAR to directory
list_archive (path)List TAR contents

Dependencies