Skip to main content

ValidationService

ValidationService validates files and RDIndex objects.
Internally, it uses HasherService to verify file and chunk hashes.


Methods

MethodReturnsDescription
validateFile(entry, path)Promise<boolean>Validates a single file against its FileEntry.
validateIndex(index, basePath)Promise<boolean>Validates all files described in an RDIndex.

Method Details

validateFile(entry, path)

Verifies a file.

Parameters:

NameTypeDescription
entryFileEntryMetadata of the file to validate
pathstringPath to the file on disk

Returns: Promise<boolean>true if the file is valid.

Notes: Uses HasherService internally to verify the hash of the file and its chunks.


validateIndex(index, basePath)

Verifies every file within a rd-index.json.

Parameters:

NameTypeDescription
indexRDIndexRDIndex object describing files to validate
basePathstringDirectory containing the files

Returns: Promise<boolean>true if all files are valid.

Notes: Internally calls validateFile for each file using HasherService.