Ruby WGet

Discussion in 'Ruby' started by Marc Heiler, Apr 9, 2009.

  1. Marc Heiler

    Marc Heiler Guest

    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?
    --
    Posted via http://www.ruby-forum.com/.
    Marc Heiler, Apr 9, 2009
    #1
    1. Advertising

  2. 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
    Robert Klemme, Apr 9, 2009
    #2
    1. Advertising

  3. Marc Heiler

    Ben Lovell Guest

    [Note: parts of this message were removed to make it a legal post.]

    On Thu, Apr 9, 2009 at 11:00 AM, Marc Heiler <> 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
    Ben Lovell, Apr 9, 2009
    #3
  4. 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/cat-on-steroids/

    (and a followup at)

    http://matthewkwilliams.com/index.php/2008/09/11/universal-cat-redux/

    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
    Matthew K. Williams, Apr 9, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert P. J. Day
    Replies:
    2
    Views:
    389
    Robert P. J. Day
    Dec 16, 2004
  2. olivier HARO

    a simple wget in C language?

    olivier HARO, Oct 14, 2004, in forum: C Programming
    Replies:
    10
    Views:
    1,603
    Ilja Booij
    Nov 3, 2004
  3. Yang
    Replies:
    6
    Views:
    3,689
  4. Jesse

    Popen and wget, problems

    Jesse, May 12, 2007, in forum: Python
    Replies:
    3
    Views:
    529
  5. Joao Silva
    Replies:
    4
    Views:
    212
    Choi, Junegunn
    Feb 9, 2009
Loading...

Share This Page