开发者

IO error: seeking to local header : while reading from a remote server using Archive::Zip,PERL

开发者 https://www.devze.com 2023-01-21 03:43 出处:网络
Want to read the contents from a .csv file which is in a remote zip file without downloading & extracting the zip file to local machine.

Want to read the contents from a .csv file which is in a remote zip file without downloading & extracting the zip file to local machine.

I need this because the file zip file size is too large and downloading it whenever needed takes longer time.

I am trying this in perl.

My code is : my $ftp = Net::FTP::AutoReconnect->new("ftp.somename.com"); $ftp->login("user","password"); $ftp->cwd("path");

my $fh = Net::FTP::RetrHandle->new($ftp,"filename.zip");
my $zip = Archive::Zip->new($fh);
my @member_names = $zip->memberNames();
my $member1 =  $zip->memberNamed("Basic/BoardDescriptions.csv");

my $string = $member1->contents();
print Dumper $string;

I get io::seeking to local header error while calling contents method, till that statement 开发者_如何转开发i guess the code is working fine.

Thanks in advance to any one who gives a try to it. Thanks.


My guess is that this is not Archive::ZIP 's fault .. can you print @member_names ?

It's not obvious how your'e suppose to extract an individual file, although Net::FTP::RetrHandle does promise it:

This was originally designed for use with Archive::Zip; it's reliable enough that the table of contents and individual files can be extracted from a remote ZIP archive without downloading the whole thing.

Try doing the same with another file from another server..

0

精彩评论

暂无评论...
验证码 换一张
取 消