def download_to_file url, file
      url = URI.parse(URI.encode(url.strip))

      File.new(file, File::CREAT)

      Net::HTTP.start(url.host) { |http|
        resp = http.get(url.path)
        open(file, "wb") { |file|
          file.write(resp.body)
        }
      }
    end
def download_to_file url, file
      url = URI.parse(URI.encode(url.strip))

      File.new(file, File::CREAT)

      Net::HTTP.start(url.host) { |http|
        resp = http.get(url.path)
        open(file, "wb") { |file|
          file.write(resp.body)
        }
      }
    end
def download_to_file url , file url = URI . parse ( URI . encode ( url . strip ) ) File . new ( file , File :: CREAT ) Net :: HTTP . start ( url . host ) { | http | resp = http . get ( url . path ) open ( file , "wb" ) { | file | file . write ( resp . body ) } } end
Download a url to a file path
Download a url to a file path