Archive-Zip-SimpleZip
view release on metacpan or search on metacpan
lib/Archive/Zip/SimpleUnzip.pm view on Meta::CPAN
{
my $inner = shift;
my $member = shift;
*$inner->{NewStream} = 0 ;
*$inner->{EndStream} = 0 ;
*$inner->{TotalInflatedBytesRead} = 0;
*$inner->{Info}{TrailerLength} = 0;
# disable streaming if present & set sizes from central dir
# TODO - this will only allow a single file to be read at a time.
# police it or fix it.
*$inner->{ZipData}{Streaming} = 0;
*$inner->{ZipData}{Crc32} = $member->{CRC32};
*$inner->{ZipData}{CompressedLen} = $member->{CompressedLength};
*$inner->{ZipData}{UnCompressedLen} = $member->{UncompressedLength};
*$inner->{CompressedInputLengthRemaining} =
*$inner->{CompressedInputLength} = $member->{CompressedLength};
}
lib/Archive/Zip/SimpleUnzip.pm view on Meta::CPAN
}
my %data = (
'Name' => $filename,
'Comment' => $comment,
'LocalHeaderOffset' => $locHeaderOffset,
'CompressedLength' => $compressedLength ,
'UncompressedLength' => $uncompressedLength ,
'CRC32' => $crc32 ,
#'Time' => _dosToUnixTime($lastModTime),
#'Stream' => $streamingMode,
#'Zip64' => $zip64,
#
#'MethodID' => $compressedMethod,
);
push @CD, \%data;
$Members{$filename} = \%data ;
++ $index;
}
lib/Archive/Zip/SimpleZip.pm view on Meta::CPAN
corresponds to a file that will be stored in a filesystem. This
information is very useful when archiving files from a filesystem - it
means the unzipped files will more closely match their originals. If the
zip file isn't going to be unzipped to a filesystem you can save a few
bytes by enabling <Minimal>.
This parameter defaults to 0.
=item C<< Stream => 0|1 >>
This option controls whether the zip archive is created in I<streaming
mode>.
Note that when outputting to a file or filehandle with streaming mode
disabled (C<Stream> is 0), the output file/handle I<must> be seekable.
When outputting to '-' (STDOUT) the C<Stream> option is automatically
enabled.
The default is 0.
=item C<< Zip64 => 0|1 >>
ZIP64 is an extension to the Zip archive structure that allows
lib/Archive/Zip/SimpleZip.pm view on Meta::CPAN
=head2 Can I write a Zip Archive directly to a socket?
See previous question.
=head2 What is a Streamed Zip file?
Streaming mode allows you to write a zip file in situation where you cannot
seek backwards/forwards. The classic examples are when you are working with
sockets or need to write the zip file to STDOUT.
By default C<Archive::Zip::SimpleZip> does I<not> use streaming mode when
writing to a zip file (you need to set the C<Stream> option to 1 to enable
it).
If you plan to create a streamed Zip file be aware that it will be slightly
larger than the non-streamed equivalent. If the files you archive are
32-bit the overhead will be an extra 16 bytes per file written to the zip
archive. For 64-bit it is 24 bytes per file.
=head1 SUPPORT
lib/Archive/Zip/StreamedUnzip.pm view on Meta::CPAN
*CLOSE = \&close;
}
1;
__END__
=head1 NAME
Archive::Zip::StreamedUnzip - Read Zip Archives in streaming mode
=head1 SYNOPSIS
use Archive::Zip::StreamedUnzip qw($StreamedUnzipError) ;
my $z = Archive::Zip::StreamedUnzip->new('my.zip')
or die "Cannot open zip file: $StreamedUnzipError\n" ;
# Iterate through a zip archive
lib/Archive/Zip/StreamedUnzip.pm view on Meta::CPAN
# or a line at a time
$line = <$fh> ;
close $fh;
$z->close();
=head1 DESCRIPTION
Archive::Zip::StreamedUnzip is a module that allows reading of Zip archives in streaming mode.
This is useful if you are processing a zip coming directly off a socket without having to
read the complete file into memory and/or store it on disk. Similarly it can be handy when
woking with a pipelined command.
Working with a streamed zip file does have limitations, so
most of the time L<Archive::Zip::SimpleUnzip> and/or L<Archive::Zip> are a better choice of
module for reading file files.
For writing Zip archives, there is a companion module,
called L<Archive::Zip::SimpleZip>, that can create Zip archives.
( run in 0.524 second using v1.01-cache-2.11-cpan-4d50c553e7e )