I am trying to write a script to check if a given URL exists and return itself, if it exists. The file types will be .jpg and .mov.
I am currently using the open-uri std library but I'm pretty sure I should be using something else.
begin
if (open(image_url).read)
puts image_url
end
if (open(video_url).read)
puts video_url
end
rescue
end
As you can see this is pretty inefficient because it reads the entire file. Any other solutions?