From: James Edward Gray II Date: 2007-03-05T01:13:59+09:00 Subject: Re: How to download file from web site On Mar 4, 2007, at 10:10 AM, Bil Kleb wrote: > ara.t.howard@noaa.gov wrote: >> require 'open-uri' >> uri = 'http://rubyforge.org/frs/download.php/17670/ >> RMagick-1.15.3.tar.gz' >> open(uri) do |fin| >> open(File.basename(uri), 'w') do |fout| >> while(buf = fin.read(8192)) >> fout.write buf >> end >> end >> end > > He asks naively... > > Why is this so complicated, e.g., the 8192 buffered write, etc.? So you don't try to slurp a very large file into Ruby's memory I'm guessing. James Edward Gray II