def download
      raise "#{@source_url} is not accessible" unless @url.valid?
      f = open(@file_path,'wb')
      count = 0
      @url.net_http.request_get(@url.path) do |r|
        r.read_body do |s|
          @download_length += s.length
          f.write s
          if block_given?
            count += 1
            if count % 100 == 0
              yield @download_length
            end
          end
        end
      end
      f.close
      downloaded = @download_length
      @download_length = 0
      downloaded
    end
def download
      raise "#{@source_url} is not accessible" unless @url.valid?
      f = open(@file_path,'wb')
      count = 0
      @url.net_http.request_get(@url.path) do |r|
        r.read_body do |s|
          @download_length += s.length
          f.write s
          if block_given?
            count += 1
            if count % 100 == 0
              yield @download_length
            end
          end
        end
      end
      f.close
      downloaded = @download_length
      @download_length = 0
      downloaded
    end
downloads a given file into a specified filename.
 If block is given returns download progress