Comparing download times of base R and the curl package:

  url <- 'https://jeroen.github.io/data/nycflights13.json'
  tmp <- tempfile()
  system.time(download.file(url, tmp, quiet = F)
  system.time(curl::curl_download(url, tmp, quiet = F))

Because this is an uncompressed file, the gzipped download is about 7x faster.

For the solution see https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html :

> To aid applications not having to bother about what specific algorithms this 
> particular libcurl build supports, libcurl allows a zero-length string to be 
> set ("") to ask for an Accept-Encoding: header to be used that contains all 
> built-in supported encodings.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to