Skip to main content

Archives

The Archives system in Tellusim provides read-only access to various archive formats, enabling seamless retrieval and searching of files stored within them.

info

The Archive system is ideal for packaging assets such as textures, models, scripts, and configuration files into a single compressed file for deployment, distribution, or content streaming.

info

Support for additional Archive formats can be added via the ArchiveStream interface.

Supported Archive Formats

Tellusim Core SDK supports the following Archive formats out of the box:

  • ZIP archives (*.zip), including support for ZIP64 extensions for large files.

  • Uncompressed and compressed TAR archives (*.tar, *.tar.gz, *.tgz).

info

Uncompressed ZIP and TAR archives operate as views over a single mapped file, allowing efficient access without full extraction.

Engine SDK Extensions

The Engine SDK additionally supports *.asset directories treated as archive resources. This allows directories to be accessed using the same interface as compressed archives, enabling unified handling of both file-based and directory-based assets.

Example

#include <format/TellusimArchive.h>

// Open Archive
Archive archive;
if(!archive.open("archive.zip")) return false;

// Archive info
TS_LOGT(Message, "{0}: {1}\n", archive.getName(), archive.getNumFiles());

// Archive files
for(uint32_t i = 0; i < archive.getNumFiles(); i++) {

// File info
String name = archive.getFileName(i);
TS_LOGT(Message, "{0}: {1} | {2} | {3}\n", i,
String::fromBytes(archive.getFileSize(i)),
Date(archive.getFileMTime(i)).getString(),
name
);

// Open file
Stream stream = archive.openFile(name);
if(!stream) continue;

// Load file
}