From: Jonathan Nielsen Date: 2010-07-02T01:16:20+09:00 Subject: Re: AUDIO FILE DOWNLOAD IN RUBY --001636426a534d7e65048a55cad2 Content-Type: text/plain; charset=UTF-8 On Thu, Jul 1, 2010 at 10:05 AM, kevid wrote: > I am trying to download it and save it locally. the file is in mp3 > format. > > What your current code would do is print the contents of the mp3 file to the console. Since it's all binary data, this is not very useful. What you need to do is open a file and write the download contents to it. One way to do this is: require 'net/http' url = "http://stream.esvmedia.org/mp3-play/hw/19023001-19023006.mp3" res = Net::HTTP.get_response(URI.parse(url)) File.open('output.mp3','w') do |f| f.write(res.body) end For more information on writing to files, see http://ruby-doc.org/core/classes/File.html -Jonathan Nielsen --001636426a534d7e65048a55cad2--