.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "STREAMZIP 1p" .TH STREAMZIP 1p "2021-02-21" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" streamzip \- create a zip file from stdin .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& producer | streamzip [opts] | consumer \& producer | streamzip [opts] \-zipfile=output.zip .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This program will read data from \f(CW\*(C`stdin\*(C'\fR, compress it into a zip container and, by default, write a \fIstreamed\fR zip file to \f(CW\*(C`stdout\*(C'\fR. No temporary files are created. .PP The zip container written to \f(CW\*(C`stdout\*(C'\fR 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'\fR option. .SS "\s-1OPTIONS\s0" .IX Subsection "OPTIONS" .IP "\-zip64" 5 .IX Item "-zip64" Create a Zip64\-compliant zip container. Use this option if the input is greater than 4Gig. .Sp Default is disabled. .IP "\-zipfile=F" 5 .IX Item "-zipfile=F" Write zip container to the filename \f(CW\*(C`F\*(C'\fR. .Sp Use the \f(CW\*(C`Stream\*(C'\fR option to force the creation of a streamed zip file. .IP "\-member\-name=M" 5 .IX Item "-member-name=M" This option is used to name the \*(L"file\*(R" in the zip container. .Sp Default is '\-'. .IP "\-stream" 5 .IX Item "-stream" Ignored when writing to \f(CW\*(C`stdout\*(C'\fR. .Sp If the \f(CW\*(C`zipfile\*(C'\fR option is specified, including this option will trigger the creation of a streamed zip file. .Sp Default: Always enabled when writing to \f(CW\*(C`stdout\*(C'\fR, otherwise disabled. .IP "\-method=M" 5 .IX Item "-method=M" Compress using method \f(CW\*(C`M\*(C'\fR. .Sp Valid method names are .Sp .Vb 6 \& * 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 .Ve .Sp Note that Lzma compress needs \f(CW\*(C`IO::Compress::Lzma\*(C'\fR to be installed. .Sp Note that Zstd compress needs \f(CW\*(C`IO::Compress::Zstd\*(C'\fR to be installed. .Sp Default is \f(CW\*(C`deflate\*(C'\fR. .IP "\-0, \-1, \-2, \-3, \-4, \-5, \-6, \-7, \-8, \-9" 5 .IX Item "-0, -1, -2, -3, -4, -5, -6, -7, -8, -9" Sets the compression level for \f(CW\*(C`deflate\*(C'\fR. Ignored for all other compression methods. .Sp \&\f(CW\*(C`\-0\*(C'\fR means no compression and \f(CW\*(C`\-9\*(C'\fR for maximum compression. .Sp Default is 6 .IP "\-version" 5 .IX Item "-version" Display version number .IP "\-help" 5 .IX Item "-help" Display help .SS "Examples" .IX Subsection "Examples" Create a zip file bt reading daa from stdin .PP .Vb 1 \& $ echo Lorem ipsum dolor sit | perl ./bin/streamzip >abcd.zip .Ve .PP Check the contents of \f(CW\*(C`abcd,zip\*(C'\fR with the standard \f(CW\*(C`unzip\*(C'\fR utility .PP .Vb 6 \& Archive: abcd.zip \& Length Date Time Name \& \-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\- \-\-\-\-\- \-\-\-\- \& 22 2021\-01\-08 19:45 \- \& \-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\- \& 22 1 file .Ve .PP Notice how the \f(CW\*(C`Name\*(C'\fR is set to \f(CW\*(C`\-\*(C'\fR. That is the default for a few zip utilities whwre the member name is not given. .PP If you want to explicitly name the file, use the \f(CW\*(C`\-member\-name\*(C'\fR option as follows .PP .Vb 1 \& $ 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 .Ve .SS "When to write a Streamed Zip File" .IX Subsection "When to write a Streamed Zip File" A Streamed Zip File is useful in situations where you cannot seek backwards/forwards in the file. .PP 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. .PP Similarly if your workfow uses a Linux pipelined commands. .SH "SUPPORT" .IX Header "SUPPORT" General feedback/questions/bug reports should be sent to (preferred) or . .SH "AUTHOR" .IX Header "AUTHOR" Paul Marquess \fIpmqs@cpan.org\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2019\-2021 Paul Marquess. All rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.