Class: FcrepoWrapper::Downloader
- Inherits:
-
Object
- Object
- FcrepoWrapper::Downloader
- Defined in:
- lib/fcrepo_wrapper/downloader.rb
Class Method Summary collapse
Class Method Details
.fetch_with_progressbar(url, output) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fcrepo_wrapper/downloader.rb', line 3 def self.(url, output) = ProgressBar.create(title: File.basename(url), total: nil, format: "%t: |%B| %p%% (%e )") open(url, content_length_proc: lambda do|t| if t && 0 < t .total = t end end, progress_proc: lambda do|s| .progress = s end) do |io| IO.copy_stream(io, output) end end |