From: Clifford Heath Date: 2007-09-09T14:45:06+09:00 Subject: Re: net/http and binary files Constantin Gavrilescu wrote: > I'm using the code from the example > http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html > This works fine for html files. But for binary files the result is a > corrupted file. > I've run this in the console: >>> Net::HTTP.start('localhost', 80){|http|File.open('result.mp3', 'w'){|f|http.g > et('/crocodil2/adrian.mp3') {|str|f.write str}}} > => # > The mp3 files is corrupted. It does not seem to be base64 encoded... > help please. The example works on *nix systems, but on Windoze, you must write the file in binary mode: File.open('result.mp3', 'wb') Clifford Heath.