For a project I need to download regularly data files from different websites to create an indicator based on those files.
As the update frequency of those files varies a lot, I am looking for an efficient way to detect whether a remote file was updated.
Below is suggested to use the -I option of curl. How does this translate in using the curl package?
https://superuser.com/questions/619592/get-modification-time-of-remote-file-over-http-in-bash-script
Alternate solutions seem to parse the header for either filesize or modifcation date:
Something similar to:
PHP: Remote file size without downloading file
My attempt below (with a small file), however, downloads the full file.
library(curl)
req <- curl_fetch_memory("http://www.pcr.uu.se/digitalAssets/124/124932_1ucdponesided2015.rdata")
str(req)
object.size(req)
parse_headers(req$headers)
Ist it possible to either download just the header with the curl package or to specify an option to avoid redundant downloads?