ccheetham / gmail.com wrote: > On Jan 1, 1:56 pm, Tim Hunter <TimHun... / nc.rr.com> wrote: >> thefed wrote: >> >>> On Dec 31, 2007, at 7:20 PM, Tim Hunter wrote: >>>> thefed wrote: >>>>> But doesn't open-uri download the whole thing to your compy? I was >>>>> about to use it, but then I ran it in irb and saw it returned a file >>>>> object. >>>> Isn't that what you want to happen? I thought your question was about >>>> how to download it in small chunks so it's not all in memory at the >>>> same time. This code downloads the whole file, but 8kb at a time. >>> No, I thought when you use Kernel#open with open-uri, it FIRST downloads >>> the entire 1GB file to your temp folder, and THEN runs your block on >>> that file in temp >> Interesting. I just tried downloading a 6.1MB file with open-uri and >> didn't see that behavior. I'm using Ruby 1.8.6 on OS X 10.5. > > Hmmm ... fetching a ~5MB file over HTTP, the entire file was > downloaded prior to the 8192 chunk reads. Ruby 1.8.6 p111 on Solaris > 2.11. Same behavior with JRuby. FWIW, I'm observing interface stats > to make my determination. > Fascinating. Learning every day... *Where* did it download the file to? Did it write it to disk or just keep it all in memory? -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html