file_matches_string: Compare a file to a string

file_matches_stringR Documentation

Compare a file to a string

Description

Check whether the md5 digest of a string matches the digest of a file. In other words, are the contents of the string and the file the same.

Usage

file_matches_string(path, string, append = "\n")

Arguments

path

String giving the path to the file.

string

Character scalar to hash and compare to hash of file

append

Character scalar to append to the end of string. Defaults to "\n" because helpers like writeLines() and readr::write_lines() automatically append a "\n" to a string when writing to a file.

Details

Similar to file_matches but takes a string that will be hashed to MD5 before comparing. By default it also appends a new line to the end of the string before hashing (because most file writer functions do this automatically).

Value

TRUE if path matches string, otherwise FALSE (including if path doesn't exist).


metrumresearchgroup/rbabylon documentation built on April 21, 2024, 3:26 a.m.