Download a zip file and extract to a directory

Discussion in 'Perl Misc' started by david.karr, Apr 9, 2010.

  1. david.karr

    david.karr Guest

    I've written some scripts that manipulate Zip files using
    Archive::Zip. I'm now working on a script that uses "LWP::Simple" to
    download data from a URL. As part of this process I'm going to have
    to download a zip file from a URL and then extract that zip file to a
    particular directory.

    Can I use LWP::Simple to download a binary file directly into a
    variable?

    I've looked at the Archive::Zip methods, and it doesn't appear as if I
    can create the Zip object directly from the contents of a variable.
    Will I have to download the zip file directly to a temporary file
    (using "getstore($url, $file)"), I would imagine), and then create the
    Zip object from that?

    I see the "extractToFileHandle( $fh )" method on Archive::Zip. Is that
    file handle supposed to be a directory?
    david.karr, Apr 9, 2010
    #1
    1. Advertising

  2. david.karr

    david.karr Guest

    On Apr 9, 3:34 pm, "david.karr" <> wrote:
    > I've written some scripts that manipulate Zip files using
    > Archive::Zip.  I'm now working on a script that uses "LWP::Simple" to
    > download data from a URL.  As part of this process I'm going to have
    > to download a zip file from a URL and then extract that zip file to a
    > particular directory.
    >
    > Can I use LWP::Simple to download a binary file directly into a
    > variable?
    >
    > I've looked at the Archive::Zip methods, and it doesn't appear as if I
    > can create the Zip object directly from the contents of a variable.
    > Will I have to download the zip file directly to a temporary file
    > (using "getstore($url, $file)"), I would imagine), and then create the
    > Zip object from that?
    >
    > I see the "extractToFileHandle( $fh )" method on Archive::Zip. Is that
    > file handle supposed to be a directory?


    Oh, never mind. Using "Archive::Extract" is much easier for
    extraction.
    david.karr, Apr 10, 2010
    #2
    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. sunil_varma
    Replies:
    1
    Views:
    1,170
  2. abcd
    Replies:
    7
    Views:
    510
    Edward Elliott
    May 1, 2006
  3. majj81
    Replies:
    0
    Views:
    330
    majj81
    May 31, 2006
  4. Chris Lambacher

    Re: Add file to zip, or replace file in zip

    Chris Lambacher, Jun 1, 2006, in forum: Python
    Replies:
    0
    Views:
    598
    Chris Lambacher
    Jun 1, 2006
  5. John
    Replies:
    7
    Views:
    345
    Moonlit
    Aug 19, 2006
Loading...

Share This Page