Checksums {reproducible} | R Documentation |
Calculate checksum
Description
Verify (and optionally write) checksums.
Checksums are computed using .digest()
, which is simply a
wrapper around digest::digest
.
Usage
Checksums(
path,
write,
quickCheck = getOption("reproducible.quickCheck", FALSE),
checksumFile = identifyCHECKSUMStxtFile(path),
files = NULL,
verbose = getOption("reproducible.verbose", 1),
...
)
## S4 method for signature 'character,logical'
Checksums(
path,
write,
quickCheck = getOption("reproducible.quickCheck", FALSE),
checksumFile = identifyCHECKSUMStxtFile(path),
files = NULL,
verbose = getOption("reproducible.verbose", 1),
...
)
## S4 method for signature 'character,missing'
Checksums(
path,
write,
quickCheck = getOption("reproducible.quickCheck", FALSE),
checksumFile = identifyCHECKSUMStxtFile(path),
files = NULL,
verbose = getOption("reproducible.verbose", 1),
...
)
Arguments
path |
Character string giving the directory path containing |
write |
Logical indicating whether to overwrite |
quickCheck |
Logical. If |
checksumFile |
The filename of the checksums file to read or write to.
The default is ‘CHECKSUMS.txt’ located at
|
files |
An optional character string or vector of specific files to checksum.
This may be very important if there are many files listed in a
|
verbose |
Numeric, -1 silent (where possible), 0 being very quiet,
1 showing more messaging, 2 being more messaging, etc.
Default is 1. Above 3 will output much more information about the internals of
Caching, which may help diagnose Caching challenges. Can set globally with an
option, e.g., |
... |
Passed to |
Value
A data.table
with columns: result
, expectedFile
,
actualFile
, checksum.x
, checksum.y
,
algorithm.x
, algorithm.y
, filesize.x
, filesize.y
indicating the result of comparison between local file (x
) and
expectation based on the CHECKSUMS.txt
file.
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, see https://github.com/PredictiveEcology/SpaDES/issues/295#issuecomment-246513405.
Author(s)
Alex Chubaty
Examples
## Not run:
modulePath <- file.path(tempdir(), "myModulePath")
dir.create(modulePath, recursive = TRUE, showWarnings = FALSE)
moduleName <- "myModule"
cat("hi", file = file.path(modulePath, moduleName)) # put something there for this example
## verify checksums of all data files
Checksums(modulePath, files = moduleName)
## write new CHECKSUMS.txt file
Checksums(files = moduleName, modulePath, write = TRUE)
## End(Not run)