title: How to download an image file via HTTP into a temp file?
body: <p>I've found <a href="https://stackoverflow.com/questions/2263540/how-do-i-download-a-binary-file-over-http">good examples</a> of NET::HTTP for downloading an image file, and I've found <a href="http://www.ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html" rel="noreferrer">good examples</a> of creating a temp file. But I don't see how I can use these libraries together. I.e., how would the creation of the temp file be worked into this code for downloading a binary file?</p>
  
  <pre><code>require 'net/http'
  
  Net::HTTP.start("somedomain.net/") do |http|
      resp = http.get("/flv/sample/sample.flv")
      open("sample.flv", "wb") do |file|
          file.write(resp.body)
      end
  end
  puts "Done."
  </code></pre>