Forum: Ruby Ruby WGet

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2009-04-09 12:00
Hi,

I would need a ruby "wget version" which works on linux and windows.

I would like to feed it an URL to a .tar.bz2 or .zip or .tar.gz file and
have it download. That's what it basically should do.

Right now I use

system 'wget '+the_url

which does not work on windows easily (but will work on pretty much all
the linuxes out there)

I once wrote a minimal ruby wget wrapper but it has some problems as the
code is years old and messy :/  so I was wondering if anyone is using
some ruby-wget thing?
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (Guest)
on 2009-04-09 12:25
(Received via mailing list)
On 09.04.2009 12:00, Marc Heiler wrote:
> I would need a ruby "wget version" which works on linux and windows.
>
> I would like to feed it an URL to a .tar.bz2 or .zip or .tar.gz file and
> have it download. That's what it basically should do.

> I once wrote a minimal ruby wget wrapper but it has some problems as the
> code is years old and messy :/  so I was wondering if anyone is using
> some ruby-wget thing?

It seems Net::HTTP is everything you need, especially since you just
want to download a single file and did not mention other requirements.

Kind regards

  robert
146e52d49d361f85c0945487452fc6a0?d=identicon&s=25 Ben Lovell (benl)
on 2009-04-09 12:29
(Received via mailing list)
On Thu, Apr 9, 2009 at 11:00 AM, Marc Heiler <shevegen@linuxmail.org>
wrote:

> Hi,
>
> I would need a ruby "wget version" which works on linux and windows.
>
> I would like to feed it an URL to a .tar.bz2 or .zip or .tar.gz file and
> have it download. That's what it basically should do.
>

Net::HTTP should be adequate, no?

Ben
C3a0d479bd322818d766a7e869c6c5b2?d=identicon&s=25 Matthew K. Williams (Guest)
on 2009-04-09 14:47
(Received via mailing list)
I'd suggest using openuri -- it's a lot more flexible than net::http.

Not to toot my own horn, but I've a version of cat which opens uri's,
files, etc...., which you might consider basing your code upon -- it's
at:

http://matthewkwilliams.com/index.php/2008/09/10/c...

(and a followup at)

http://matthewkwilliams.com/index.php/2008/09/11/u...

Hope this helps,
Matt

--
"... if you do follow your bliss you put yourself on a kind of
track that has been there all the while, waiting for you, and the life
that you ought to be living is the one you are living. When you can
see that, you begin to meet people who are in your field of bliss, and
they open doors to you. I say, follow your bliss and don't be afraid,
and doors will open where you didn't know they were going to be." --
Joseph Campbell
This topic is locked and can not be replied to.