# Unzip Files Online – Extract ZIP, TAR, GZ & 7z from URLs (`gazidev/archive-extractor`) Actor

Extract ZIP, TAR, TAR.GZ, GZ and 7z archives from URLs in bulk. Every file inside is saved with a public link, size, type and SHA-256, and listed in one dataset; use filters to keep only PDFs, images or CSVs. Bomb-safe limits, no password cracking. $3 per 1,000 archives + storage.

- **URL**: https://apify.com/gazidev/archive-extractor.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 archive extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Unzip Files Online – Extract ZIP, TAR, GZ & 7z from URLs

Paste links to **ZIP, 7z, TAR, TAR.GZ / TGZ, TAR.BZ2, TAR.XZ, GZ, BZ2 or XZ** archives and get **every file inside** as its own download link, plus one clean dataset that lists each file's path, size, type, modified date and **SHA-256**. No software to install, no upload limits in a browser tab, and it works on hundreds of archives in one run or as a step after another Actor.

**$3 per 1,000 archives + $0.20 per 1,000 files saved.** Failed downloads, encrypted archives and zip-bomb rejections are free.

### What it does

1. Downloads each archive URL (redirects followed, retries on 429/5xx, private-network links refused).
2. Detects the real format from the file's first bytes (not the file name).
3. Opens the archive with zip-bomb limits and streams each file out.
4. Saves each file to the run's key-value store (or a named store) with a public link, and pushes one dataset row per file.

### Use cases

- **Government and open-data bulk downloads** that arrive as `.zip` or `.tar.gz` (company registers, tenders, statistics): unzip and feed the CSVs straight into the next Actor.
- **Chain with scrapers:** a scraper or [Bulk File Downloader](https://apify.com/gazidev/bulk-file-downloader) outputs archive links → this Actor (pick its dataset in *Apify dataset with archive URLs*) → every file inside gets its own link.
- **Keep only what you need:** `fileExtensions: ["pdf"]` or `["csv","xlsx"]` and `pathContains: "invoices/"`. Filtered files are not saved and not charged.
- **Inventory without saving:** turn off *Save files* to list contents with sizes and SHA-256 hashes (only the archive event is charged).
- **AI agents:** give an agent a ZIP link and get back a JSON list of files with direct links.

### Input example

```json
{
  "archiveUrls": [
    "https://github.com/octocat/Hello-World/archive/refs/heads/master.zip",
    "https://github.com/octocat/Spoon-Knife/archive/refs/heads/main.tar.gz"
  ],
  "fileExtensions": [],
  "extractNestedArchives": false,
  "saveFiles": true
}
```

| Field | Default | Notes |
|---|---|---|
| `archiveUrls` | 2 small demo archives | Direct links to archives. |
| `datasetId` + `datasetField` | – | Read archive links from another run's dataset. |
| `fileExtensions` | all | e.g. `pdf`, `csv`, `jpg`. |
| `pathContains` | – | Keep only paths containing this text. |
| `skipJunkFiles` | `true` | Skips `__MACOSX/`, `._*`, `.DS_Store`, `Thumbs.db`. |
| `extractNestedArchives` | `false` | Open archives inside the archive, **one level deep** only. |
| `saveFiles` | `true` | Off = list contents only. |
| `keyValueStoreName` | – | Named store to keep files beyond the default retention. |
| `maxArchiveSizeMb` | 1000 | Download limit per archive (max 2,000). |
| `maxUncompressedMb` | 2000 | Hard cap **2 GB** uncompressed per archive. |
| `maxEntriesPerArchive` | 10000 | Hard cap **10,000** entries. |
| `maxCompressionRatio` | 100 | Hard cap **100×**. |

### Output (one row per file)

```json
{
  "archiveUrl": "https://github.com/octocat/Spoon-Knife/archive/refs/heads/main.tar.gz",
  "archiveName": "Spoon-Knife-main.tar.gz",
  "format": "tar.gz",
  "path": "Spoon-Knife-main/README.md",
  "fileName": "README.md",
  "extension": "md",
  "bytes": 780,
  "contentType": "text/markdown",
  "sha256": "f93aba3ff091ee0b498ae165ff08453620f9802fc6098662e0b9ce57b7273e6d",
  "modifiedAt": "2014-02-12T23:20:44+00:00",
  "nestedIn": null,
  "storedUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/002-Spoon-Knife-main.tar.gz__Spoon-Knife-main__README.md",
  "key": "002-Spoon-Knife-main.tar.gz__Spoon-Knife-main__README.md",
  "status": "saved",
  "errorCode": null,
  "error": null
}
```

- `status`: `saved`, `listed` (*Save files* off), `error` (one file could not be read, free), or for a whole archive `failed` / `blocked` / `rejected` (free) with an `errorCode` such as `HTTP_404`, `ENCRYPTED`, `BOMB_RATIO`, `BOMB_TOO_LARGE`, `TOO_MANY_ENTRIES`, `NOT_AN_ARCHIVE`, `UNSUPPORTED_FORMAT`.
- Store keys keep the folder structure: `/` becomes `__`.
- `OUTPUT` in the key-value store has a summary per archive (entries, files saved, filtered, uncompressed bytes).

### Safety limits (and why)

- **Zip bombs:** each archive may expand to at most **2 GB**, **10,000 entries** and **100×** its download size. Declared sizes are checked before anything is extracted, and the real decompressed bytes are counted while streaming, so an archive that lies about its sizes is still stopped. Rejected archives are free and nothing from them is kept.
- **Path traversal ("zip slip"):** names like `../../etc/x` or `C:\x` are never used as file paths. Each file is streamed into a randomly named temp file and stored under a cleaned key (`etc/x`).
- **Links and special files** (symlinks, hard links, devices) are skipped, never followed.
- **No execution:** files are only copied, hashed and stored. Nothing inside an archive is opened, run or scanned for content.
- **No password cracking:** encrypted ZIP/7z archives are refused as a free row. There is no password field.
- **Web content** (`.html`, `.svg`, `.js`, `.xml`) is stored as `text/plain`, so a public link cannot run scripts in a browser. The row's `contentType` still shows the real type.
- Links to private or local network addresses (including after redirects) are refused.

### Limits, honestly

- **RAR is not supported** (proprietary format). Neither are multi-part (`.zip.001`, `.7z.001`) archives, ISO images or `.zst`.
- Nested archives are opened **one level deep** only; deeper ones are saved as files.
- Extraction happens on the Actor's disk: for archives that expand beyond ~1 GB, run with 2 GB+ memory.
- Stored files live in your Apify storage: the default store is deleted after your plan's retention period, and **storage of large outputs counts against your Apify account**. Use `keyValueStoreName` to keep files, or *Save files* off to only list them.
- This is not an antivirus. Files are stored as they are.

### Pricing

| Event | Price | When |
|---|---|---|
| Archive extracted | **$0.003** | Once per archive that was opened (also when the filter leaves 0 files) |
| File saved | $0.0002 | Per file stored with a link |
| Actor start | $0.00005 | Per run |

Free: download errors, blocked URLs, encrypted archives, unsupported formats, zip-bomb rejections and files that fail to extract. A 200-file ZIP costs $0.003 + 200 × $0.0002 = **$0.043**. The run stops cleanly when your *Max total charge* is reached.

There were no unzip Actors with active users in the Apify Store when this was published, so there is no price comparison table.

### How this differs from our other file Actors

- [Bulk File Downloader](https://apify.com/gazidev/bulk-file-downloader) downloads lists of files and can **create** ZIPs. This Actor does the opposite: it **opens** archives and gives you each file inside.
- [Spreadsheet to JSON](https://apify.com/gazidev/spreadsheet-to-json) converts the CSV/XLSX files you get out of an archive into JSON rows.

### FAQ

**Can it open password-protected ZIPs if I give the password?** No. Encrypted archives are refused on purpose.

**Does it keep the folder structure?** Yes: `path` is the full path inside the archive and the store key mirrors it with `__` for `/`.

**Can I use a file from my computer?** Put it on any host that gives a direct download link (or a public Apify key-value store record link) and paste that link.

**What about `.tar.gz` that is really a single `.gz` file?** The format is detected from the content: a gzip that contains a TAR is unpacked as TAR, otherwise the single file is decompressed (`data.csv.gz` → `data.csv`).

### Use with AI agents / Apify MCP

Add `gazidev/archive-extractor` to the [Apify MCP server](https://mcp.apify.com). An agent passes `{"archiveUrls": ["https://…/data.zip"], "fileExtensions": ["csv"]}` and gets back a list of files with `storedUrl` links it can read next.

# Actor input Schema

## `archiveUrls` (type: `array`):

Direct download links to .zip, .7z, .tar, .tar.gz/.tgz, .tar.bz2, .tar.xz, .gz, .bz2 or .xz files, one per line. Redirects are followed. Links to private or local network addresses are refused.

## `datasetId` (type: `string`):

Extract the archives linked in another run's dataset, e.g. the output of Bulk File Downloader or a scraper. Set the field name below.

## `datasetField` (type: `string`):

Column that holds the archive link (a string or a list of strings). Empty = the first of url, fileUrl, downloadUrl, archiveUrl, zipUrl, storedUrl, link, href.

## `fileExtensions` (type: `array`):

e.g. pdf, csv, jpg. Empty = keep every file. Filtered files are not saved and not charged.

## `pathContains` (type: `string`):

Case-insensitive text that the path inside the archive must contain, e.g. `invoices/` or `2025`.

## `skipJunkFiles` (type: `boolean`):

Skip \_*MACOSX/ folders, .* resource forks, .DS_Store, Thumbs.db and desktop.ini.

## `extractNestedArchives` (type: `boolean`):

A .zip inside the .zip is opened too (one level deep only); its files get paths like `inner.zip/file.pdf`. Off = inner archives are saved as files.

## `saveFiles` (type: `boolean`):

On: every file is stored in the key-value store with a public link. Off: the dataset only lists each file's path, size, type and SHA-256 (no file-saved charge).

## `keyValueStoreName` (type: `string`):

Save the files into a named store that is kept after the default 7-day retention. Empty = the run's default store.

## `maxArchives` (type: `integer`):

Stop after this many archive URLs. 0 = all.

## `maxArchiveSizeMb` (type: `integer`):

Larger downloads are refused (free row).

## `maxUncompressedMb` (type: `integer`):

Hard cap 2,000 MB. Checked on the declared sizes first, then on the real bytes while extracting. Use 2 GB+ memory for archives that expand beyond ~1 GB.

## `maxEntriesPerArchive` (type: `integer`):

Hard cap 10,000 files and folders per archive (nested archives count too).

## `maxCompressionRatio` (type: `integer`):

Refuse archives that expand to more than this many times their download size (hard cap 100x; archives that expand to under 1 MB are always allowed).

## `maxConcurrency` (type: `integer`):

Archives downloaded and extracted at the same time (1-4). Each needs disk space for its files.

## Actor input object example

```json
{
  "archiveUrls": [
    "https://github.com/octocat/Hello-World/archive/refs/heads/master.zip",
    "https://github.com/octocat/Spoon-Knife/archive/refs/heads/main.tar.gz"
  ],
  "skipJunkFiles": true,
  "extractNestedArchives": false,
  "saveFiles": true,
  "maxArchives": 0,
  "maxArchiveSizeMb": 1000,
  "maxUncompressedMb": 2000,
  "maxEntriesPerArchive": 10000,
  "maxCompressionRatio": 100,
  "maxConcurrency": 2
}
```

# Actor output Schema

## `files` (type: `string`):

No description

## `results` (type: `string`):

No description

## `store` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "archiveUrls": [
        "https://github.com/octocat/Hello-World/archive/refs/heads/master.zip",
        "https://github.com/octocat/Spoon-Knife/archive/refs/heads/main.tar.gz"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/archive-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "archiveUrls": [
        "https://github.com/octocat/Hello-World/archive/refs/heads/master.zip",
        "https://github.com/octocat/Spoon-Knife/archive/refs/heads/main.tar.gz",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("gazidev/archive-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "archiveUrls": [
    "https://github.com/octocat/Hello-World/archive/refs/heads/master.zip",
    "https://github.com/octocat/Spoon-Knife/archive/refs/heads/main.tar.gz"
  ]
}' |
apify call gazidev/archive-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gazidev/archive-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/jcgQcI6eIk8Iyn1MC/builds/C22xk53nSpohGaiw3/openapi.json
