natiny_resource_pack

C
int natiny_resource_pack(const char* input,
                         const char* output,
                         uint32_t part_size,
                         const char* key);

Writes a folder as index.pack plus numbered pack files while preserving resource names relative to the input folder.

Parameters

Name Type Description
input const char* Non-empty folder path to read recursively; must not be NULL
output const char* Non-empty folder path to create and write; may equal input and must not be NULL
part_size uint32_t Maximum uncompressed bytes per numbered pack; 0 selects 1 MiB and values from 1 to 4095 are raised to 4096
key const char* Passphrase used to encrypt the packs; NULL or "" writes them unencrypted

Returns

Type Description
int 1 when the index and every numbered pack were written; 0 on failure or on an unsupported platform

Example

C
if (!natiny_resource_pack("data", "build/data", 0, "my secret"))
    return 1;

Notes

  • Packing is supported on desktop platforms. It reports an error on stderr and returns 0 on Android, iOS and the web.
  • Empty files are skipped, and the complete input folder is held in memory during packing.