Progress Download

Simple customisable progress bar in Ruby.

Usage

You may test it out in your terminal by doing:

progress-download [STYLE] [URI]
# For example
progress-download --style pump http://ipv4.download.thinkbroadband.com/10MB.zip

In Ruby

# Basic usage
url = 'http://ipv4.download.thinkbroadband.com/10MB.zip'
ProgressBar.download url
# More advanced options include:
ProgressBar.download url, :location => '~/Downloads', :style => :classic, :speed => 0.1, :refresh => 0.5

By default:

  • :location is the current working directory (Dir.getwd)
  • :style is :dots
  • :speed is 1 and
  • :refresh is 0.125

:refresh is the amount of time between 'frames' in seconds, by this :speed is how many times the spinner updates per frame drawn, meaning thusly that :speed must be 1 or less, 1 meaning that the spinner advances one step for every 'frame' drawn, and 0.5 would be every second frame, etc.