Name
streamzip - create a zip file from stdinSynopsis
\& producer | streamzip [opts] | consumer \& producer | streamzip [opts] -zipfile=output.zipDescription
This program will read data from \f(CW\*(C`stdin\*(C', compress it into a zip container and, by default, write a streamed zip file to \f(CW\*(C`stdout\*(C'. No temporary files are created.The zip container written to \f(CW\*(C`stdout\*(C' is, by necessity, written in streaming format. Most programs that read Zip files can cope with a streamed zip file, but if interoperability is important, and your workflow allows you to write the zip file directly to disk you can create a non-streamed zip file using the \f(CW\*(C`zipfile\*(C' option.
\S-1Options\S0
Create a Zip64-compliant zip container. Use this option if the input is greater than 4Gig. Default is disabled.
Write zip container to the filename \f(CW\*(C`F\*(C'. Use the \f(CW\*(C`Stream\*(C' option to force the creation of a streamed zip file.
This option is used to name the \*(L"file\*(R" in the zip container. Default is '-'.
Ignored when writing to \f(CW\*(C`stdout\*(C'. If the \f(CW\*(C`zipfile\*(C' option is specified, including this option will trigger the creation of a streamed zip file. Default: Always enabled when writing to \f(CW\*(C`stdout\*(C', otherwise disabled.
Compress using method \f(CW\*(C`M\*(C'. Valid method names are \& * store Store without compression \& * deflate Use Deflate compression [Deflault] \& * bzip2 Use Bzip2 compression \& * lzma Use LZMA compression \& * xz Use xz compression \& * zstd Use Zstandard compression Note that Lzma compress needs \f(CW\*(C`IO::Compress::Lzma\*(C' to be installed. Note that Zstd compress needs \f(CW\*(C`IO::Compress::Zstd\*(C' to be installed. Default is \f(CW\*(C`deflate\*(C'.
Sets the compression level for \f(CW\*(C`deflate\*(C'. Ignored for all other compression methods. \&\f(CW\*(C`-0\*(C' means no compression and \f(CW\*(C`-9\*(C' for maximum compression. Default is 6
Display version number
Display help
Examples
Create a zip file bt reading daa from stdin\& $ echo Lorem ipsum dolor sit | perl ./bin/streamzip >abcd.zip
Check the contents of \f(CW\*(C`abcd,zip\*(C' with the standard \f(CW\*(C`unzip\*(C' utility
\& Archive: abcd.zip \& Length Date Time Name \& --------- ---------- ----- ---- \& 22 2021-01-08 19:45 - \& --------- ------- \& 22 1 file
Notice how the \f(CW\*(C`Name\*(C' is set to \f(CW\*(C`-\*(C'. That is the default for a few zip utilities whwre the member name is not given.
If you want to explicitly name the file, use the \f(CW\*(C`-member-name\*(C' option as follows
\& $ echo Lorem ipsum dolor sit | perl ./bin/streamzip -member-name latin >abcd.zip
\& $ unzip -l abcd.zip \& Archive: abcd.zip \& Length Date Time Name \& --------- ---------- ----- ---- \& 22 2021-01-08 19:47 latin \& --------- ------- \& 22 1 file
When To Write A Streamed Zip File
A Streamed Zip File is useful in situations where you cannot seek backwards/forwards in the file.A good examples is when you are serving dynamic content from a Web Server straight into a socket without needing to create a temporary zip file in the filesystsm.
Similarly if your workfow uses a Linux pipelined commands.
Support
General feedback/questions/bug reports should be sent to <https://github.com/pmqs/IO-Compress/issues> (preferred) or <https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress>.Author
Paul Marquess [email protected].Copyright
Copyright (c) 2019-2021 Paul Marquess. All rights reserved.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.