简体   繁体   English

压缩文件并打印到标准输出

[英]Zip file and print to stdout

I need archive file with zip and print zip-data to stdout in realtime.我需要带 zip 的存档文件并将 zip 数据实时打印到标准输出。 Standard zip program may create zip file only.标准 zip 程序只能创建 zip 文件。 This can do gzip with -c attribute, but it use gzip algorithm.这可以使用 -c 属性执行 gzip,但它使用 gzip 算法。

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.当您使用-作为文件名时,Info-ZIP 中的zip程序(通常在 Linux 系统上找到的那个程序)允许将 ZIP 文件生成到标准输出中。 For example you could send a zip file to port 8787 on a remote host with this command:例如,您可以使用以下命令将 zip 文件发送到远程主机上的端口 8787:

zip -r - files_to_be_archived | nc remotehost 8787

All of this is documented on the zip command manual page .所有这些都记录在zip 命令手册页上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM