title: How to determine the file size of a remote download without reading the entire file with R
body: <p>Is there a reasonably straightforward way to determine the file size of a remote file without downloading the entire file? Stack Overflow answers how to do this <a href="https://stackoverflow.com/questions/2602612/php-remote-file-size-without-downloading-file">with PHP and curl</a>, so I imagine it's possible in R as well. If possible, I believe it would be better to avoid RCurl, since that requires an additional installation for non-Windows users?</p>
  
  <p>On <a href="http://asdfree.com/" rel="nofollow noreferrer">this survey analysis website</a>, I write lots of scripts to automatically download large data files from government agencies (like the us census bureau and the cdc). I am trying to implement an additional component that will <em>not</em> download a file that has already been downloaded, by creating a "download cache" - but I am concerned that this "download cache" might get corrupted if: 1) the host website changes a file or 2) the user cancels a download midway through. Therefore, when deciding whether to download a file from the source HTTP or FTP site, I want to compare the local file size to the remote file size.. And if they are not the same, download the file again.</p>