Archiver
Archiver is a tool for data archiving, which handles UNG files. It implements encrypting to avoid unauthorized data access.
The contents of UNG archives are completely transparent to the engine: archived files are accessed using their standard paths, as if they were not packed. However, it's important to note that:
- A UNG package cannot contain another UNG package.
- A mount point cannot be packed into an archive, although it can reference one.
- Data Streaming is not supported for compressed files within archives. Although compressed files in archives benefit from faster read speeds, they cannot be streamed. Therefore, by deafult, only files that do not require streaming are compressed.
- Compression of binary formats (e.g. .texture, .mesh or .lmap) is not recommended, since these formats are already compressed internally and require streaming for efficient runtime loading.
- For files whose extensions are marked for compression, the LZ4 compression algorithm is applied. The list of compressible extensions is specified at the time of package creation.
For more information, refer to the article: File System.
To invoke Archiver, run <UnigineSDK>/bin/ung_x64.exe (in Windows) or <UnigineSDK>/bin/ung_x64 (in Linux) from a command-line console.
Command Line Options#
Archiver recognizes the following command-line options:
-
-p <PASSWORD> - set a password. It should be the same password as passed on engine initialization on the API side. For more information refer to the article Protecting Your Data with a Password.
NoticeYou can skip password setting if it is not required. The engine supports loading UNG packages without password protection even if the password was specified on its initialization. - -x <FILE> - exclude the specified files from packaging into the archive.
- -o <ARCHIVE> - name the output archive.
- -e <ARCHIVE> - extract files from the archive.
- -i <ARCHIVE> - list all files from the archive along with their respective sizes.
- -s <ARCHIVE> - output detail information about the archive.
-
-c <EXTENSIONS> - enable compression for the specified extensions. If no extensions are provided, compression will be enabled by deafult for the following extensions: json, xml, txt, node, world, prop, track, mat, basemat.
NoticeIf you specify your own extensions, the default ones will not be used, only the extensions you explicitly list will be applied.
Statisctics Overview#
When you request statistics for an archive using the -s <ARCHIVE>, the output includes both general and extension-specific statistics
General Statistics:
- Num files - Displays total number of files in archive.
- Size - Displays the original size of the archive and the compressed size.
- Compression diff - Indicates the amount of space saved by compression.
- Compression rate - Displays the compression ratio as a percentage, representing how much smaller the compressed archive is compared to the original.
Per-Extension Statistics Table:
- Extension: The file extension (e.g. texture, json, xml)
- Size: The total size occupied by files of this extension, showing the original and compressed sizes.
- Diff: The total amount of space saved for this extension.
- Rate total: The overall compression rate for all files with this extension.
- Rate average: The average compression rate across all files of this type.
- Rate median: The median compression rate, showing the most common compression outcome.
- Rate min: The minimum compression rate observed for this extension.
- Rate max: The maximum compression rate observed for this extension.
Usage Examples#
The following creates an archive named files.ung that contains files file.txt and file.tga.
ung_x64 -o files.ung file.txt file.tga
The following extracts all files from the archive created above:
ung_x64 -e files.ung
The following prints statistics related to the archive:
ung_x64 -i files.ung
The following creates an archive named files.ung that contains files file.txt and file.tga protected with a password "12345":
ung_x64 -p 12345 -o files.ung file.txt file.tga
The information on this page is valid for UNIGINE 2.20 SDK.