Verify (and optionally write) checksums for data files in a module's data/ subdirectory. The file data/CHECKSUMS.txt contains the expected checksums for each data file. Checksums are computed using reproducible:::.digest, which is simply a wrapper around digest::digest.

checksums(module, path, ...)

Arguments

module

Character string giving the name of the module.

path

Character string giving the path to the module directory.

...

Passed to reproducible::Checksums(), notably, write, quickCheck, checksumFile and files.

Details

Modules may require data that for various reasons cannot be distributed with the module source code. In these cases, the module developer should ensure that the module downloads and extracts the data required. It is useful to not only check that the data files exist locally but that their checksums match those expected.

Note

In version 1.2.0 and earlier, two checksums per file were required because of differences in the checksum hash values on Windows and Unix-like platforms. Recent versions use a different (faster) algorithm and only require one checksum value per file. To update your CHECKSUMS.txt files using the new algorithm:

  1. specify your module (moduleName <- "my_module");

  2. use a temporary location to ensure all modules get fresh copies of the data (tmpdir <- file.path(tempdir(), "SpaDES_modules"));

  3. download your module's data to the temp dir (downloadData(moduleName, tmpdir));

  4. initialize a dummy simulation to ensure any 'data prep' steps in the .inputObjects section are run (simInit(modules = moduleName));

  5. recalculate your checksums and overwrite the file (checksums(moduleName, tmpdir, write = TRUE));

  6. copy the new checksums file to your working module directory (the one not in the temp dir) (file.copy(from = file.path(tmpdir, moduleName, 'data', 'CHECKSUMS.txt'), to = file.path('path/to/my/moduleDir', moduleName, 'data', 'CHECKSUMS.txt'), overwrite = TRUE)).