STREAMZIP(1perl)
β¨ NAME β¨
streamzip β bestie, it makes a zip file straight out of stdin π
This is one of the pages from the Perl Programmers Reference Guide, and yes it's giving main character energy.
πΈ SYNOPSIS πΈ
producer | streamzip [opts] | consumer
producer | streamzip [opts] -zipfile=output.zip
π¦ DESCRIPTION π¦
okay so here's the tea: this program reads data from stdin, compresses it into a zip container and, by default, writes a streamed zip file out to stdout. And the best part? No temporary files are created. Not one. Zero. None. π
The zip container written to stdout is, by necessity, written in streaming format. Most programs that read Zip files can cope with a streamed zip file, but β and this is the part you don't wanna skip β 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 zipfile option. Slay. π
π OPTIONS π
-zip64β Create a Zip64-compliant zip container. Use this option if the input is greater than 4Gig.
Default is disabled.
-zipfile=Fβ Write the zip container to the filenameF.
Use the Stream option to force the creation of a streamed zip file.
-member-name=Mβ This option is used to name thefilein the zip container.
Default is -.
-streamβ Ignored when writing tostdout.
If the zipfile option is specified, including this option will trigger the creation of a streamed zip file.
Default: Always enabled when writing to stdout, otherwise disabled.
-method=Mβ Compress using methodM.
Valid method names are
storeβ Store without compressiondeflateβ Use Deflate compression [Default]bzip2β Use Bzip2 compressionlzmaβ Use LZMA compressionxzβ Use xz compressionzstdβ Use Zstandard compression
Note that Lzma compress needs IO::Compress::Lzma to be installed.
Note that Zstd compress needs IO::Compress::Zstd to be installed.
Default is deflate.
-0,-1,-2,-3,-4,-5,-6,-7,-8,-9β Sets the compression level fordeflate. Ignored for all other compression methods.
-0 means no compression and -9 for maximum compression.
Default is 6
-versionβ Display version number-helpβ Display help
π Examples π
Create a zip file bt reading daa from stdin π (yes bestie, that's the vibe, we're reading data and zipping it)
$ echo Lorem ipsum dolor sit | perl ./bin/streamzip >abcd.zip
Check the contents of abcd,zip with the standard unzip utility
Archive: abcd.zip
Length Date Time Name
--------- ---------- ----- ----
22 2021-01-08 19:45 -
--------- -------
22 1 file
Notice how the Name is set to -. That is the default for a few zip utilities where the member name is not given.
If you want to explicitly name the file, use the -member-name 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 filesystem. No temp file, no problem, periodt.
Similarly if your workflow 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 pmqs@cpan.org.
π COPYRIGHT π
Copyright (c) 2019-2026 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.
okay that's the whole page bestie, you ate that π this was the streamzip page, perl v5.44.0, dated 2026-10-17 β go forth and pipe things into things πβ¨π¦
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms