checkSha256 | R Documentation |
Validates files by calculating their SHA256 checksums and comparing
them to the expected hash. Returns a named boolean vector indicating matching
or mismatching files, by path. error
can be set to return FALSE
or NA
for problem files instead of throwing an error. File names can be any mix of
absolute and relative paths, where relative is to the current working directory.
checkSha256(checksums = NULL, files = NULL, error = NA, ext = ".sha256")
checksums |
A vector or list of expected checksums. If named, they will
be treated as a dictionary of hash values. If unnamed, file
names must be provided in parallel in |
files |
The files to check as a string vector. If |
error |
Boolean value. |
ext |
If only files are specified and checksums are not, checksums are
expected to be provided in "note" files stored on the file system in
parallel to the files being validated. For every file to check, the name of
the matching "note" file is obtained by suffixing this extension to the
name of the file it matches. The note file should contain the checksum of
the matching file as a string. The hash string should be the only thing
in the file. It doesn't matter if the checksum string ends with an EOL or
not. This generally should start with a "." and by default will be |
The expected checksums
hash strings for files can be provided as a list or vector and can be
named. The files specified via files
will be validated using
these checksums. If named, all checksums must be named for the path to the
file they validate. They are treated like a
"dictionary" from which the expected checksum of a file can be looked up, by path. If
unnamed, then checksums must be in the same order and have the same length
as the provided files
vector.
If checksums
are not specified, then for each file in files
, a
"note" file containing the string checksum as its only content (EOL
optional) will be looked for. They are expected to be named the same as the
files
, but with the addition of the extension ext
(by default .sha256
).
It is an error if an expected .sha256
note file is not found, but this behavior
can be configured by setting error
.
A boolean vector indicating if files match their provided SHA256 checksum hashes.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.