I'm trying to use Pipe Viewer (pv) while extracting files from zip archive.
Now I'm using
unzip -o -q myfile.zip -d testSo I tried something like (solution seen for tar)
pv myfile.zip | unzip -o -q - -d testBut it's not working. What would be the correct syntax?
2 Answers
The source of the problem is not the syntax, but the build-in difference between tar and zip.
The problem with submitting zip file via pipe is based on zip design
A directory is placed at the end of a .ZIP file. This identifies what files are in the .ZIP and identifies where in the .ZIP that file is located. This allows .ZIP readers to load the list of files without reading the entire .ZIP archive
When providing zip via pipe - the directory will be accessed only after the entire file will be supplied by the pipe, hence pv should be completed before unzip should start - which cause the failure you are facing.
Take bsdtar for using unzip via pipe. Example:
$ sudo apt install libarchive-tools
$ wget -qO- |sudo bsdtar -xvf- -C /usr/local/share/fonts/ 1