[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Download Zip File

Paul Fraser

2/26/2008 12:49:00 PM

I have tried to use rio gem to download a zip file (in windows) but it
results in a corrupt d/l. I think this is because binary mode is not
available in rio.
So I am now trying to use open-uri

require 'open-uri'
f = open (url)

f is of class tempfile. How do I save this temp file to disk?
Does open-uri have a binary mode option, or is it the default?

Or is there a more elegant ruby way to d/l binary mode files ?

Thanks
Paul Fraser


1 Answer

Thomas Wieczorek

2/26/2008 2:35:00 PM

0

I used the example at http://snippets.dzone.com/posts... to
download some pictures, the "wb" is important, so that the file is
opened in binary mode, otherwise you'll end up with ascii mode and
your file contains corrupted data.