Helix Core is now P4 and Helix Swarm is now P4 Code Review. Learn more >>

Documentation | 2025.2

# Zip archive

When the `zip` command-line tool is installed on the P4 Code Review server, P4 Code Review allows users to download ZIP archives of files and folders. You can download a Zip archive using the Download zip option from the following P4 Code Review pages:

- Review display page.
- Changelists page.
- Files page.

## Installation

Install the zip command-line tool from your operating system distribution using `apt-get`, `yum`, etc.

## Configuration

If you make a configuration change, P4 Code Review will not use it until the configuration cache has been reloaded, this forces P4 Code Review to use the new configuration. You must be an admin or super user to reload the P4 Code Review config cache. Navigate to the User id dropdown menu, select System Information, click the Cache Info tab, and click the Reload Configuration button.

Configure the archiving feature with the following configuration block in the `SWARM_ROOT/data/config.php` file:

    <?php
        // this block should be a peer of 'p4'
        'archives' => array(
          'max_input_size'    => 512 * 1024 * 1024, // 512M (in bytes)
          'archive_timeout'   => 1800,              // 30 minutes
          'compression_level' => 1,                 // 0-9
          'cache_lifetime'    => 60 * 60 * 24,      // 1 day
        ),

The `max_input_size` key specifies the maximum file/folder content size that can be processed into a ZIP archive. The default value permits up to 512 megabytes of content to be compressed. Smaller values limit the amount of file/folder content but provide faster downloads; larger values can allow increased scanning, syncing, compressing, and downloading times.

The `archive_timeout` key specifies the amount of time, in seconds, to allow P4 Code Review to prepare the ZIP archive for downloading. Shorter times can limit the practical size of a ZIP archive, depending on the performance of your network and the filesystem hosting P4 Code Review; even with a generous `max_input_size` setting, if `archive_timeout` seconds have elapsed, the archive operation is terminated.

The `compression_level` key specifies the compression level to use, and must be within the range `0` to `9`. 0 means no compression, `9` means maximum compression. As this value is increased, smaller ZIP archives may result, but may require greater compression time. P4 Code Review uses the default of `1`, which provides a reasonable tradeoff of fast compression times with light compression that can still result in an archive notably smaller than the original file/folder content.

The `cache_lifetime` key specifies the desired maximum age of cached ZIP archives. Increasing the value increases the amount of time that ZIP archives exist in the cache, which can improve the user experience for frequently downloaded files. However, ZIP archives can be quite large (depending on the size of your depot within the P4 Server) and can require significant disk storage. Decreasing the value can mitigate the amount of disk space required for the cache; the tradeoff is that frequently accessed ZIP archives may need to be generated more frequently, which can have an impact on CPU and disk resources.

## Download files as a Zip archive

To download the zip archive navigate to the review, changelist, file or folder:

The Download zip option is not displayed if the zip command-line tool is not installed on the P4 Code Review server. For information about installing, and configuring the zip command-line tool, see Zip archive.

When you select the Download zip option, P4 Code Review performs the following steps:

1. Scans the files/folders:
   - Checks that you have permission to access their contents, according to the P4 Server protections.
   - Checks that the total file size is small enough to be processed by P4 Code Review.
2. Syncs the file contents to the P4 Code Review server from the P4 Server.
3. Creates the ZIP archive by compressing the file content.
4. Starts a download of the generated ZIP archive.

- You might not see all of the above steps; P4 Code Review caches the resulting ZIP archives so that repeated requests to the same files/folders can skip the sync and compress steps whenever possible.
- If an error occurs while scanning, syncing, or compressing, P4 Code Review indicates the error.

Your search for returned results