R/get_file_hash.R

Defines functions get_file_hash

Documented in get_file_hash

#' Calculate hash from file
#'
#' Returns the SHA1 hash of a given file
#' 
#' @keywords internal
#'
#' @param filename a \code{string} specifying a filename
#'
#' @family get functions
#'
get_file_hash <- function(filename) {
  if (!file.exists(filename))
    stop(paste0("File ", filename, " does not exist"))
  file(filename) %>%
    openssl::sha1() %>%
    as.character() %>%
    as.character()
}

Try the rDataPipeline package in your browser

Any scripts or data that you put into this service are public.

rDataPipeline documentation built on Oct. 8, 2024, 5:06 p.m.