It might be handy if this package implemented some functions to take a file size and download speed and calculate the time needed to download.
Remembering how to go from MB to Mbps to seconds, etc is confusing.
# check file head size
tx_url <- "https://www.ethics.state.tx.us/data/search/cf/TEC_CF_CSV.zip"
tx_head <- httr::HEAD(url = tx_url)
(tx_length <- fs::as_fs_bytes(httr::headers(tx_head)[["content-length"]]))
#> 541M
# test download speed
config <- speedtest::spd_config()
servers <- speedtest::spd_servers(config = config)
closest_servers <- speedtest::spd_closest_servers(servers, config = config)
speed <- speedtest::spd_download_test(closest_servers[1, ], config = config)
speed[, 11:15]
#> # A tibble: 1 x 5
#> min mean median max sd
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 6.55 34.6 38.2 61.2 19.4
# seconds to download
((as.numeric(tx_length)/1e+6) / (speed$median / 8))
#> [1] 118.6992
Created on 2020-02-27 by the reprex package (v0.3.0)
It might be handy if this package implemented some functions to take a file size and download speed and calculate the time needed to download.
Remembering how to go from MB to Mbps to seconds, etc is confusing.
Created on 2020-02-27 by the reprex package (v0.3.0)