testArchive

fnTestResult testArchive(const ArchiveHandle h) @safe

Verifies archive integrity by checking all stored files.

This function tests the archive by reading and verifying all file data against stored checksums. It detects data corruption without extracting files to disk.

Parameters

harchive handle obtained from openArchiveRead

Returns

A TestResult struct containing:
  • filesChecked — number of files verified
  • errors — number of corruption errors found

Throws

DarException if the archive handle is invalid or testing fails.

Example:

auto archive = openArchiveRead("/backups", "myarchive", "dar");
auto result = testArchive(archive);

if (result.errors == 0)
    writefln("Archive OK: %d files verified", result.filesChecked);
else
    writefln("CORRUPTION: %d errors in %d files", result.errors, result.filesChecked);

fnTestResult testArchive(const ArchiveHandle h, TestOptions to) @safe

Tests an archive using custom TestOptions.

This overload allows partial testing by applying a selection mask or changing what aspects to verify.