
Write file with md5 hash check
write_file_md5(
x,
path = NULL,
method = mark_write_methods(),
overwrite = NA,
quiet = FALSE,
encoding = "UTF-8",
compression = getOption("mark.compress.method", mark_compress_methods()),
...
)mark_write_methods()
mark_compress_methods()
write_file_md5()
: x
, invisibly. When path
is not the stdout()
, x
is returned with the attribute "path"
set to the result of
file_copy_md5()
.
mark_write_methods()
: A list of applicable methods and their aliases
mark_compress_methods()
: A character vector of applicable compression
methods
An object to write to file
The file or connection to write to (dependent on part by method)
The method of saving the file. When default
, the method is
determined by file extension of path
, if present, otherwise by the type
of object of x
.
When NA
, only saves if the md5 hashes do not match.
Otherwise, see fs::file_copy()
.
When TRUE
, suppresses messages from md5 checks.
The encoding to use when writing the file.
The compression method to use when writing the file.
Additional arguments passed to the write function.
mark.compress.method
: compression method to use when writing files
mark.list.hook
: when a data.frame
contains a list
column, this
function is applied to each element of the list. The default "auto"
uses toJSON()
if the package jsonlite
is available, otherwise
# just writes to stdout()
df <- data.frame(a = 1, b = 2)
write_file_md5(df)
temp <- tempfile()
write_file_md5(df, temp) # new
write_file_md5(df, temp) # same
df$c <- 3
write_file_md5(df, temp) # changes
fs::file_delete(temp)
Run the code above in your browser using DataLab