R/download.R

Defines functions mydownload

mydownload <- function(url, destfile) {
    if (is.installed('httr2')) {    
        req <- httr2::request(url) |> 
            httr2::req_progress()
        
        req |> httr2::req_perform(path = destfile)
    } else {
        download.file(url = url, destfile = destfile)
    }
}
YuLab-SMU/yulab.utils documentation built on April 14, 2025, 1:54 p.m.