# ZIP File V2

**ZIP File V2** compresses files into `.zip` format, optionally reducing their size.

## **Parameters**

Take a look at the configuration parameters for the connector. Parameters supported by [Double Braces expressions](https://docs.digibee.com/documentation/connectors-and-triggers/double-braces/overview) are marked with `(DB)`.

### **General tab**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>ZIP Operation</strong></td><td>Define the type of operation (<code>Compress</code>, <code>Multiple Compress</code>, or <code>Decompress</code>).</td><td><code>Compress</code></td><td>String</td></tr><tr><td><strong>Compression Method</strong></td><td><p>The compression method to be used. Options are: </p><ul><li><strong>Store</strong>: Doesn’t compress the file. Recommended for files that are already compressed or don’t require compression. Faster processing.</li><li><strong>Deflate</strong>: Compresses the file. Suitable for most data types, especially text and files with repeated patterns. Slower processing.</li></ul></td><td><code>Store</code></td><td>String</td></tr><tr><td><strong>ZIP Encryption Method</strong></td><td><p>The ZIP encryption method to be used. Options are: </p><ul><li><strong>Zip Standard</strong>: Basic encryption method compatible with most ZIP tools. Offers lower security. </li><li><strong>AES</strong>: Advanced Encryption Standard. Provides stronger security but may not be supported by all ZIP tools.</li></ul></td><td><code>Zip Standard</code></td><td>String</td></tr><tr><td><strong>ZIP AES Key Strength</strong></td><td>Defines the strength of the encryption key when using <strong>AES</strong> as <strong>ZIP Encryption Method</strong>. Options are: <strong>Key Strength 128</strong> and <strong>Key Strength 256</strong>.</td><td><code>Key Strength 128</code></td><td>String</td></tr><tr><td><strong>File Name</strong> <code>(DB)</code></td><td>Name or full path of the file to be compressed (for example, <code>tmp/processed/file.txt</code>). In the <strong>Multiple Compress</strong> operation, this field is also available when you click <strong>Add</strong> in the <strong>Files</strong> parameter.</td><td><code>data.csv</code></td><td>String</td></tr><tr><td><strong>Output File Name</strong> <code>(DB)</code></td><td>Name of the ZIP file to be generated.</td><td><code>data.zip</code></td><td>String</td></tr><tr><td><strong>Fail On Error</strong></td><td>If enabled, interrupts the pipeline execution when an error occurs. If disabled, execution continues, but the <code>"success"</code> property will be set to <code>false</code>.</td><td>False</td><td>Boolean</td></tr></tbody></table>

### **Advanced tab**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Set password</strong></td><td>When enabled, will set a password protection to the ZIP file.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Account</strong></td><td>The <a href="https://app.gitbook.com/s/jvO5S91EQURCEhbZOuuZ/platform-administration/settings/accounts">account</a> used by the connector. It is only available if the <strong>Use Dynamic Account</strong> parameter is <strong>inactive</strong>.</td><td>N/A</td><td>Account</td></tr><tr><td><strong>Use Dynamic Account</strong></td><td>When active, the connector will use the account dynamically. Otherwise, it will use the account statically.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Scoped</strong></td><td>When enabled the stored account is isolated to other sub-process. In that case, sub-processes will see their own version of the stored account data. It's not supported for accounts used in headers or body. It is only available if the <strong>Use Dynamic Account</strong> parameter is <strong>active</strong>.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Account Name</strong></td><td>The name of the dynamic account used by the connector. This account must have been previously configured in a <a href="../tools/store-account"><strong>Store Account</strong></a> connector in the pipeline for this process to take effect. It is only available if the <strong>Use Dynamic Account</strong> parameter is active.</td><td>N/A</td><td>String</td></tr></tbody></table>

### **Documentation tab**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td>Optional field to describe the connector configuration and any relevant business rules.</td><td>N/A</td><td>String</td></tr></tbody></table>

## **Messages flow**

### **Input**

The connector accepts any entry message, which can be referenced using [Double Braces](https://docs.digibee.com/documentation/connectors-and-triggers/double-braces/overview) (`{{ }}`).

### **Output**

On success:

```json
{
    "fileName": "data.csv",
    "success": true
}
```

On error:

```json
{
    "success": false,
    "message": "File data.csv already exists.",
    "exception": "com.digibee.pipelineengine.exception.PipelineEngineRuntimeException"
}
```

## **ZIP File V2 in action**

### **Successful response**

```json
{
    "success": true,
    "outputFileName": "data.zip"
}
```

* `outputFileName`: Name of the generated ZIP file.
* `success`: `true` if the operation was successful; otherwise, `false`.

### **Error response**

{% code overflow="wrap" %}

```json
{
    "exception": "java.io.FileNotFoundException: /tmp/pipeline-engine/3b3755ad-4256-429a-8898-2f7eea80f7db/data1.csv (No such file or directory)",
    "message": "Encountered an I/O error while executing ZipFileConnector",
    "success": false
}
```

{% endcode %}

* `success`: `false` when the operation fails.
* `message`: Description of the error.
* `exception`: Technical details about the error.

### **File handling in the pipeline**

The pipeline uses a temporary, local workspace for file operations, which is isolated and only accessible during execution.

This means file access works like a virtual file system. File names may include valid characters, extensions, and relative paths, such as:

* `data.csv`
* `processing/data.csv`

Any attempt to access absolute paths is blocked during pipeline execution.
