R
R
Roman Mirilaczvili2016-05-12 15:40:22
linux
Roman Mirilaczvili, 2016-05-12 15:40:22

How to convert from a ZIP archive using bsdtar in streaming mode (through a pipe) to a tarball file with output to stdout?

It is necessary to stream the contents of a remote ZIP archive, reading it on the other side as a pure tarball.
Today I learned that a ZIP archive can be unpacked to disk using bsdtar on the fly (via a pipe):
cat file.zip | bsdtar -xvf- -C /path/to/target_dir
Instead of unpacking files, I would like to get a tar archive, in streaming mode, for further manipulations.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Mirilaczvili, 2016-05-12
@2ord

Through a lot of trial and error, as well as studying the bsdtar documentation (not GNU / tar, but the one that works with libarchive), I finally achieved my goal:
In general, scenarios can be as follows:
or like this:

  • Thanks to the article Tanguy Using bsdtar to change an archive format found a solution
  • What are the differences between bsdtar and GNU tar?

S
Saboteur, 2016-05-12
@saboteur_kiev

zip and tar can't work with streams, they can work with files.
But gzip can work with streams, so there is a suspicion that this is not a zip archive.
Try
gunzip -c file.zip
gzip -d -c file.zip
PS there are also bzip2 and cpio that work with the stream.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question