STREAMZIP(1p)

πŸ’– NAME πŸ’–

streamzip β€” bestie, it creates a zip file from stdin. That's the whole ✨thing✨. This is the 1p page for it, obviously, so you know it's a perl situation.


πŸ¦‹ SYNOPSIS πŸ¦‹

producer | streamzip [opts] | consumer
producer | streamzip [opts] -zipfile=output.zip

🌸 DESCRIPTION 🌸

okay so picture this: this program reads data off stdin, squishes it into a zip container, and by default writes a streamed zip file straight to stdout. And the iconique part? No temporary files are created. Not one. Not ever. πŸ’…

Now, the zip container that lands on stdout is, by necessity, written in streaming format. Most programs that read Zip files can cope with a streamed zip file, no cap. But β€” and this is the part where you listen to me β€” if interoperability is important to you, and your workflow lets you write the zip file directly to disk, then you can create a non-streamed zip file using the zipfile option. πŸŽ€


✨ OPTIONS ✨

  • -zip64 β€” creates a Zip64-compliant zip container. Use this one if your input is greater than 4Gig, because otherwise, babe, it's not gonna fit. Default is disabled.
  • -zipfile=F β€” writes the zip container to the filename F, instead of the default stdout situation. Use the Stream option to force the creation of a streamed zip file. πŸ—‚οΈ
  • -member-name=M β€” this is the one that names the file inside the zip container. Default is -. (Yes, literally a dash. We'll get into why later, stay with me.)
  • -stream β€” ignored when writing to stdout (it's already doing that, bestie). 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 method M. 🧚 The valid method names are:
    • store β€” Store without compression
    • deflate β€” Use Deflate compression [Default]
    • bzip2 β€” Use Bzip2 compression
    • lzma β€” Use LZMA compression
    • xz β€” Use xz compression
    • zstd β€” Use Zstandard compression
Heads up: Lzma compress needs IO::Compress::Lzma to be installed. Also heads up: 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 for deflate. Ignored for all other compression methods, so don't come crying to me when -9 does nothing on bzip2. -0 means no compression and -9 is for maximum compression. Default is 6.
  • -version β€” display version number πŸ‘‘
  • -help β€” display help 🫢

🌈 Examples 🌈

Making a zip file by reading data from stdin:

$ echo Lorem ipsum dolor sit | perl ./bin/streamzip >abcd.zip

Checking 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. Literally cannot. No seeking. 🚫

A good example 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. Main character energy, truly. ✨

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, bestie, they love it there) or <https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress>. Don't be shy. 🌸


πŸ‘‘ AUTHOR πŸ‘‘

Paul Marquess pmqs@cpan.org.


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.


and that's the tea, babe β€” this page is from perl v5.40.1, dated 2026-07-04, filed under STREAMZIP(1p). go forth and pipe something, ily πŸ’œ

πŸ“¦ where this page comes from