Search code examples
linuxzip

Zip file and print to stdout


I need archive file with zip and print zip-data to stdout in realtime. Standard zip program may create zip file only. This can do gzip with -c attribute, but it use gzip algorithm.


Solution

  • The zip program from Info-ZIP (the one usually found on Linux systems) allows generating ZIP files into the standard output, when you use - as the name of the file. For example you could send a zip file to port 8787 on a remote host with this command:

    zip -r - files_to_be_archived | nc remotehost 8787
    

    All of this is documented on the zip command manual page.