When the zip
command-line tool is installed on the Swarm server, Swarm allows users to download ZIP archives of files and folders. You can download a Zip archive using the Download .zip button from the following Swarm pages:
Install the zip command-line tool from your operating system distribution using apt-get
, yum
, etc.
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 Swarm 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 Swarm; 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. Swarm 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 Helix 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.
To download the zip archive navigate to the review, changelist, file or folder:
Files Marked for Add in pre-commit reviews and shelved changelists are not included in the zip file.
The Download .zip button is not displayed if the zip command-line tool is not installed on the Swarm server. For information about installing, and configuring the zip command-line tool, see Zip archive.
When you click the Download .zip button, Swarm performs the following steps: