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
SpaDES:::digest, which is simply a
1 2 3 4 5 6 7
Character string giving the name of the module.
Character string giving the path to the module directory.
Logical indicating whether to overwrite
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. See also
A data.frame with columns: result, expectedFile, actualFile, and checksum.
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, see https://github.com/PredictiveEcology/SpaDES/issues/295#issuecomment-246513405.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## Not run: moduleName <- "my_module" modulePath <- file.path("path", "to", "modules") ## verify checksums of all data files checksums(monudleName, modulePath) ## write new CHECKSUMS.txt file # 1. verify that all data files are present (and no extra files are present) list.files(file.path(modulePath, moduleName, "data") # 2. calculate file checksums and write to file (this will overwrite CHECKSUMS.txt) checksums(monudleName, modulePath, write = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.