Free plan

Extract Archive

Open a ZIP or other archive and get the files out
POST
/v1/documents/archive-extract

About this tool

This tool opens an archive (a package of files, such as ZIP, TAR, RAR or 7z) and gives you the files inside, one download each. It is careful: it skips files that try to escape their folder, links and password-protected files, and refuses archives that would grow absurdly big. You can pick which files to take, up to a limit.
For example, someone sends you a ZIP of photos and you want to download only the PNG pictures.

How to use it

  1. Choose this tool.
  2. Add the archive file (one file).
  3. If you like, type patterns to take only some files, or to skip some.
  4. Press Generate.
  5. Download the files you want.

What you get back

You get the files from the archive, each one ready to download. The result tells you if some were skipped or if there were more than the limit.
GOOD TO KNOW
One archive in, up to 1000 files out; each file counts as one file. Nothing is ever run. RAR and 7z are read by a separate program on the server (a runtime capability); a password-protected RAR or 7z cannot be opened.
TEST IT LIVE

Try Extract Archive in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/archive-extract
Tool ID
documents.archive-extract
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/archive-extract" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'include=["*.png"]' \
  -F 'exclude=["__MACOSX/**"]' \
  -F 'max_files=200'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.archiveExtract({
    "file": 'document.pdf',
    "include": "[\"*.png\"]",
    "exclude": "[\"__MACOSX/**\"]",
    "max_files": 200
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->archiveExtract([
    'file' => 'document.pdf',
    'include' => '["*.png"]',
    'exclude' => '["__MACOSX/**"]',
    'max_files' => 200,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Open a ZIP, TAR, TAR.GZ, RAR or 7z and get its files back, one download each. Safe by design: entries that try to escape, links and password-protected entries are skipped, and archives that expand absurdly are refused.

Extract Archive works from text and settings, so no file is needed. Every input is optional.

Extract Archive is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/archive-extract with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.