Pack file writer. More...
#include "pack/common.h"
Typedefs | |
typedef void(* | OnPackFile) (uint64_t itemIndex, void *argument) |
File packing callback. | |
Functions | |
PackResult | packFiles (const char *packPath, uint64_t fileCount, const char **fileItemPaths, float zipThreshold, bool printProgress, OnPackFile onPackFile, void *argument) |
Packs files to the Pack archive. | |
Pack file writer.
Used to pack files into a Pack archives. During packing, files are compressed with maximum ZSTD compression, or written as they are if they are already compressed. Additionally, each file is checked for data duplication, and in cases where two files are identical, a reference to the data of the already packed file is written.
typedef void(* OnPackFile) (uint64_t itemIndex, void *argument) |
File packing callback.
itemIndex | current packing item index |
argument | callback agument, or NULL |
PackResult packFiles | ( | const char * | packPath, |
uint64_t | fileCount, | ||
const char ** | fileItemPaths, | ||
float | zipThreshold, | ||
bool | printProgress, | ||
OnPackFile | onPackFile, | ||
void * | argument ) |
Packs files to the Pack archive.
The main function for packing a Pack archives. It reads the provided files and compresses them with maximum possible compression. You can speed up the runtime file decompression by specifying a zipThreshold value, as if after compression, we achieve only 10% compression, then decompression will consume more resources than we save on file size. The optimal float value for the zipThreshold is 0.1f.
[in] | packPath | output Pack file path string |
fileCount | file count to pack | |
[in] | fileItemPaths | pack file and item path string array (file/item, file/item...) |
zipThreshold | compression threshold (0.0 - 1.0 range) | |
printProgress | output packing progress to the stdout | |
[in] | onPackFile | file packing callback, or NULL |
[in] | argument | file packing callback argument, or NULL |