ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Download resume with NET::HTTP
by Alex Dj other posts by this author
May 9 2008 7:19AM messages near this date
Form_remote_tag and csv download? | Re: Download resume with NET::HTTP
I'm wondering is there any way to do interrupt file download and then
resume it from the same spot?
The way I download file:

        Net::HTTP.start("server.com") { |http|
           response = http.request_get('/some/path') {|response|
               file_length =  response['Content-Length']
               File.open('video.avi', 'w') {|f|
                   response.read_body do |str|   # read body now
                      puts  str.length
                      f.write str
                   end
               }
            }
        }

I'm not using open-url as I found that open() method first downloads
whole file and then starts to write it. Not  for me....

Cheers Alex
-- 
Posted via http://www.ruby-forum.com/.
Thread:
Alex Dj
Marcelo
Alex Dj

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved