title: Download and write .tar.gz files without corruption
body: <p>How do you download files, specifically .zip and .tar.gz, with Ruby and write them to the disk?</p>
  
  <p><sub>—<br><i>This question was originally specific to a bug in MacRuby, but the answers are relevant to the above general question.</i></sub></p>
  
  <p><sub>Using MacRuby, I've found that the file appears to be the same as the reference (in
  size), but the archives refuse to extract. What I'm attempting now is at: <a href="https://gist.github.com/arbales/8203385" rel="nofollow noreferrer">https://gist.github.com/arbales/8203385</a><br>Thanks!</sub></p>