22
I need to write code which will determine if a file exists by checking its URL.
Currently I implement this:
error_code = 400;
response = Net::HTTP.get_response(URI(url));
return response.code.to_i < error_code;
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.
How do I determine if a file exists on the remote side without downloading it?