to be able to pass method parameter from pak::pkg_install to utils::download.file added the ensure_method_type function to check and set a valid option from valid params of
c("internal", "libcurl", "wget", "curl" , "wininet" , "auto")
ensure_method_type<-function(method = NULL ){
# utils::download.file
# ...
# method
# Method to be used for downloading files.
# Current download methods are "internal", "libcurl", "wget", "curl" and "wininet" (Windows only),
# and there is a value "auto": see ‘Details’ and ‘Note’.
# The method can also be set through the option "download.file.method": see options().
types <- c("internal", "libcurl", "wget", "curl" , "wininet" , "auto")
if(is.null(method))
method<- getOption("download.file.method", default = "auto")
# to avoid side effect we will return without changing/setting options
# if no `download.file.method` option set
if( method %in% types ) return( invisible(method) )
# if only there is an invalid value set in the options at least set smt valid
# @`side effect` it will set it with the default value
options("download.file.method" = "auto" )
return( invisible("auto") )
}
some tests for the new method to check side effect
to be able to pass method parameter from
pak::pkg_install
toutils::download.file
added theensure_method_type
function to check and set a valid option from valid params ofc("internal", "libcurl", "wget", "curl" , "wininet" , "auto")
some tests for the new method to check side effect
...