verifies that, were the stamp recalculated, it would match the one previously set with stamp_set() of stamp_save().
Arguments
- x
R object to write to disk as per limitations of
fileformat.- st_dir
character: parent directory where the stamp file if saved.
- st_name
character: name of stamp (see details).
- st_file
character: path of stamp file to compare with.
- stamp
previously calculated stamp with stamp_get.
- hash
previously calculated stamp with
stamp_get(x). This will be compared against the stamps in file. You can't providexalong withhash. Of them must be NULL.- st_ext
character: format of stamp file to save. Default is value in option "stamp.default.ext"
- verbose
logical: whether to display additional information. This could be changed in option
"stamp.verbose". Default isTRUE- set_hash
Logical or character. The hash is the intermediate stamp estimated to confirm that data has not changed. If FALSE, the default, hash won't be set as part of the .stamp env. If TRUE, a random name would be assigned to the hash and it will be saved in .stamp env. If character, it would be use as the stamp name in .stamp env.
- replace
logical: replace hash in .stamp env in case it already exists. Default is FALSE.
- ...
Arguments passed on to
stamp_getalgocharacter: default is value in option "stamp.digest.algo". This argument is the algorithms to be used; currently available choices are md5, which is also the default, sha1, crc32, sha256, sha512, xxhash32, xxhash64, murmur32, spookyhash and blake3
serializeA logical variable indicating whether the object should be serialized using
serialize(in ASCII form). Setting this toFALSEallows to compare the digest output of given character strings to known control output. It also allows the use of raw vectors such as the output of non-ASCII serialization.fileA logical variable indicating whether the object is a file name or a file name if
objectis not specified.lengthNumber of characters to process. By default, when
lengthis set toInf, the whole string or file is processed.skipNumber of input bytes to skip before calculating the digest. Negative values are invalid and currently treated as zero. Special value
"auto"will cause serialization header to be skipped ifserializeis set toTRUE(the serialization header contains the R version number thus skipping it allows the comparison of hashes across platforms and some R versions).asciiThis flag is passed to the
serializefunction ifserializeis set toTRUE, determining whether the hash is computed on the ASCII or binary representation.rawA logical variable with a default value of FALSE, implying
digestreturns digest output as ASCII hex values. Set to TRUE to returndigestoutput in raw (binary) form. Note that this option is supported by most but not all of the implemented hashing algorithmsseedan integer to seed the random number generator. This is only used in the
xxhash32,xxhash64andmurmur32functions and can be used to generate additional hashes for the same input if desired.errormodeA character value denoting a choice for the behaviour in the case of error: ‘stop’ aborts (and is the default value), ‘warn’ emits a warning and returns
NULLand ‘silent’ suppresses the error and returns an empty string.
Details
st_name is the name of the stamp and it could be used in two
different ways. First, if st_dir is NULL, it is assumed that the user
refers to st_name as the stamp saved in the .stamp env and not to a
stamp saved in a particular drive. If st_dir is not NULL, then st_name
is the name of file that contains the stamp. Notice that all stamps that are
saved to disk are prefixed with the value in option "stamp.stamp_prefix",
which by default is "st_". You don't need to add the prefix, but if you do
and it happens to be the same as in "stamp.stamp_prefix", it will be
ignored.
See also
Other stamp functions:
stamp_get(),
stamp_read(),
stamp_save(),
stamp_set(),
stamp_time(),
stamp_x_attr()
Examples
if (FALSE) {
x <- data.frame(a = 1:5, b = "hola")
st_name <- "stx"
stamp_set(x, st_name, replace = TRUE)
# must provide st_dir or st_name
stamp_confirm(x, st_name = st_name)
}