Skip to main content
1 of 4
tansy
  • 769
  • 4
  • 7

For the record as this thread is quite old.

7-zip does not allow streamed write of 7z format, it requires free seeking access as it writes, amongst the other stuff, header at the end of operation. I does allow to pipe stand though standard *nix formats like bz2, gz, xz. It also allow to pipe single input without restrictions (-si switch).

So one can compress single file into 7z format but cannot pipe it further.

$ cat archive.tar | 7z a -si archive.tar.7z 

Other formats, like mentioned bz2, gz, xz can be written to stdout (-so switch).

$ cat archive.tar | 7z a -tgzip -si -so -an > archive.tar.gz == $ 7z a -si -so -tgzip -an < archive.tar > archive.tar.gz 

This obviously allows to pipe it further:

$ cat archive.tar | 7z a -tgzip -si -so -an | wc -c 

Note -an switch that disables parsing of archive_name. What it actually does, god one knows - this program is bit magical and you have to cope with its quirks. Example of this behaviour can be found here.

tansy
  • 769
  • 4
  • 7