---
id: file--stream-decompress
title: "Stream decompress"
summary: "Unpacks an archive delivered as `ViaFileStream` (ZIP, GZip, TAR, TAR.GZ, RAR, 7-Zip) and emits every contained file as its own `ViaFileStream`. The entries of one archive can form a batch."
audience: user
keywords: "input, output, autodetectcompression, compressiontype, archivepassword, batchmode"
---
# Stream decompress

Unpacks an archive delivered as `ViaFileStream` (ZIP, GZip, TAR, TAR.GZ, RAR, 7-Zip) and emits every contained file as its own `ViaFileStream`. The entries of one archive can form a batch.

## Pins

| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | `Viaducta.Plugins.Files.Types.ViaFileStream` | The archive. |
| Output | output | `Viaducta.Plugins.Files.Types.ViaFileStream` | Called once per file in the archive. |

## Configuration

| Field | Type | Default | Description |
|---|---|---|---|
| `AutoDetectCompression` | boolean | `true` | `true`: choose the format from the file name (`ViaFileStream.Name`); `CompressionType` is ignored. |
| `CompressionType` | dropdown: `0` GZip, `1` Zip, `2` Tar, `3` TarGz, `4` Rar, `5` SevenZip | `0` | Format used when `AutoDetectCompression` is `false`. |
| `ArchivePassword` | string | | Password for encrypted archives (Zip, Rar, 7-Zip). |
| `BatchMode` | dropdown: `1` Auto, `2` Always, `3` Never | `1` | Whether the entries of one archive form a batch for batch consumers (Stream compress, Write file, Build array, ...). `Auto`: only if the input file is not already in a batch; inside a batch (e.g. a file read by Read file) the entries stay in that batch. `Always`: a child batch per archive (label = archive name). `Never`: no batch. |

## Behaviour

- Auto detection by file name ending, case-insensitive: `.tar.gz` / `.tgz` → TarGz, `.gz` → GZip, `.zip` → Zip, `.tar` → Tar, `.7z` / `.7zip` → SevenZip, `.rar` → Rar. Any other name raises "Cannot detect archive format".
- Every file entry (directories are skipped) is decompressed into memory, one at a time, and emitted as a `ViaFileStream` with `Name` = entry path inside the archive (may contain folders, e.g. `data/a.csv`), `Extension` = last extension of the name, `Size` and `Stream` positioned at 0. A GZip entry gets the archive name without `.gz`.
- The archive boundary is the batch.
- When a batch is opened (`BatchMode`) it ends after the last entry was processed downstream: consumers commit then; an error that reaches the plugin fails the batch and they roll back. An archive without files emits nothing and opens no batch.
- The input stream must be seekable.

## Notes

- `FilePath` and dates of the emitted records are empty.
- Each entry is held in memory while it is processed; TarGz unpacks the whole tar into memory first.

## Example

```json
{ "AutoDetectCompression": true, "ArchivePassword": "" }
```

Collect files → Read file (`Input`) → **Stream decompress** → Write file
