DownspoutA beautiful gem that let you download files from any website or any ftp site.
Here's quick example of downspout.
Installation :
$ gem install downspout
Once done, run the rails console
$ rails c
ruby-1.9.2-p0 > link = "http://viu.eng.rpi.edu/images/lab/3/DFD33.gif"
=> "http://viu.eng.rpi.edu/images/lab/3/DFD33.gif"
#download file
ruby-1.9.2-p0 > dl = Downspout.fetch_url( link)
dl.pa => /tmp/downloads/downspout-20110420-6201-8ktgyq-1/DFD33.gif
#get downloaded file location
ruby-1.9.2-p0 > dl.path
=> "/home/sahilsk/downloads/downspout-20110420-6201-8ktgyq-1/DFD33.gif"
Now, open /home/sahilks /downloads/downs..... / folder to see your downloaded image.
so, easy and quick. :D
TIP: get list of installed gem >
sahilsk@dragonaider:~/cronfarm$ gem list
/home/sahilsk/.rvm/rubies/ruby-1.9.2-p0/bin/gem:4: warning: Insecure world writable dir /home/sahilsk in PATH, mode 040777
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.6, 3.0.5, 3.0.0)
actionpack (3.0.6, 3.0.5, 3.0.0)
activemodel (3.0.6, 3.0.5, 3.0.0)
activerecord (3.0.6, 3.0.5, 3.0.0)
activeresource (3.0.6, 3.0.5, 3.0.0)
activesupport (3.0.6, 3.0.5, 3.0.0)
addressable (2.2.5, 2.2.4)
annotate-models (1.0.4)
arel (2.0.9, 1.0.1)
autotest (4.4.6)
autotest-rails (4.1.0)
autotest-rails-pure (4.1.2)
builder (3.0.0, 2.1.2)
bundle (0.0.1)
....
....
downspout (0.2.8)
Here's quick example of downspout.
Installation :
$ gem install downspout
Once done, run the rails console
$ rails c
ruby-1.9.2-p0 > link = "http://viu.eng.rpi.edu/images/lab/3/DFD33.gif"
=> "http://viu.eng.rpi.edu/images/lab/3/DFD33.gif"
#specify the directory to save image into
ruby-1.9.2-p0 >Downspout::Config.tmp_dir = "/home/sahilsk/downloads/
#download file
ruby-1.9.2-p0 > dl = Downspout.fetch_url( link)
dl.pa => /tmp/downloads/downspout-20110420-6201-8ktgyq-1/DFD33.gif
#get downloaded file location
ruby-1.9.2-p0 > dl.path
=> "/home/sahilsk/downloads/downspout-20110420-6201-8ktgyq-1/DFD33.gif"
Now, open /home/sahilks /downloads/downs..... / folder to see your downloaded image.
so, easy and quick. :D
TIP: get list of installed gem >
sahilsk@dragonaider:~/cronfarm$ gem list
/home/sahilsk/.rvm/rubies/ruby-1.9.2-p0/bin/gem:4: warning: Insecure world writable dir /home/sahilsk in PATH, mode 040777
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.6, 3.0.5, 3.0.0)
actionpack (3.0.6, 3.0.5, 3.0.0)
activemodel (3.0.6, 3.0.5, 3.0.0)
activerecord (3.0.6, 3.0.5, 3.0.0)
activeresource (3.0.6, 3.0.5, 3.0.0)
activesupport (3.0.6, 3.0.5, 3.0.0)
addressable (2.2.5, 2.2.4)
annotate-models (1.0.4)
arel (2.0.9, 1.0.1)
autotest (4.4.6)
autotest-rails (4.1.0)
autotest-rails-pure (4.1.2)
builder (3.0.0, 2.1.2)
bundle (0.0.1)
....
....
downspout (0.2.8)
...
..
-----------------------------
Links:
documentation: http://rubydoc.info/github/sci-phi/downspout/master/frames
..
-----------------------------
Links:
documentation: http://rubydoc.info/github/sci-phi/downspout/master/frames
No comments:
Post a Comment