MCPcopy Create free account
hub / github.com/apache/arrow / download

Method download

dev/release/binary-task.rb:362–405  ·  view source on GitHub ↗
(path, output_path=nil)

Source from the content-addressed store, hash-verified

360 end
361
362 def download(path, output_path=nil)
363 url = build_read_url(path)
364 with_retry(5, url) do
365 begin
366 begin
367 headers = {}
368 if output_path and File.exist?(output_path)
369 headers["If-Modified-Since"] = File.mtime(output_path).rfc2822
370 end
371 request(:get, headers, url) do |response|
372 case response
373 when Net::HTTPNotModified
374 else
375 if output_path
376 File.open(output_path, "wb") do |output|
377 response.read_body do |chunk|
378 output.write(chunk)
379 end
380 end
381 last_modified = response["Last-Modified"]
382 if last_modified
383 FileUtils.touch(output_path,
384 mtime: Time.rfc2822(last_modified))
385 end
386 else
387 response.body
388 end
389 end
390 end
391 rescue Error => error
392 case error.response
393 when Net::HTTPNotFound
394 $stderr.puts(error.message)
395 return
396 else
397 raise
398 end
399 end
400 end
401 rescue
402 FileUtils.rm_f(output_path)
403 raise
404 end
405 end
406
407 def delete(path)
408 url = build_write_url(path)

Callers 4

downloadMethod · 0.45
releaseMethod · 0.45
download_distributionMethod · 0.45
copy-binary.rbFile · 0.45

Calls 4

exist?Method · 0.80
openMethod · 0.45
writeMethod · 0.45
bodyMethod · 0.45

Tested by

no test coverage detected