Download a zip file and extract to a directory

D

david.karr

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?
 
D

david.karr

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top