title: How do I check if a file exists using its URL without downloading it?
body: <p>I need to write code which will determine if a file exists by checking its URL.</p>
  
  <p>Currently I implement this:</p>
  
  <pre><code>error_code = 400;
  response = Net::HTTP.get_response(URI(url));
  return response.code.to_i &lt; error_code;
  </code></pre>
  
  <p>But, it's not working right because each time it downloads the file, which is really slow if I have big files or a lot of them.</p>
  
  <p>How do I determine if a file exists on the remote side without downloading it?</p>