R/is_url_valid.R

Defines functions is_url_valid

Documented in is_url_valid

#' Is the download URL valid?
#'
#' The download link expires after 4 hours.
#' @inheritParams default_params_doc
#' @return TRUE if the download URL valid, FALSE otherwise
#' @export
is_url_valid <- function(
  netmhc2pan_bin_url = get_netmhc2pan_bin_url(),
  verbose = FALSE,
  netmhc2pan_archive_filename = get_netmhc2pan_archive_filename(),
  temp_local_file = tempfile(pattern = "netmhc2pan_is_url_valid_")
) {
  is_valid <- FALSE
  tryCatch({
      suppressWarnings(
        check_netmhc2pan_bin_url(
          netmhc2pan_bin_url = netmhc2pan_bin_url,
          verbose = verbose,
          netmhc2pan_archive_filename = netmhc2pan_archive_filename,
          temp_local_file = temp_local_file
        )
      )
      is_valid <- TRUE
    },
    error = function(e) {
      if (verbose) message("Error message: '", e, "'")
    }
  )
  is_valid
}

Try the netmhc2pan package in your browser

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

netmhc2pan documentation built on Nov. 9, 2023, 1:08 a.m.