5

As follows from UNZIP(1L) man page

Archives read from standard input are not yet supported

Are there another CLI programs running under Linux/cygwin which can extract from zip archives reading them from stdin?

2
  • Hmm 7z was the first thing came to my mind but it's a no-go... 7z x -si < sample.zip returns Error: E_NOTIMPL and documentation confirms that reading zip files from stdin is not yet supported. Jul 24 '15 at 13:33
  • 1
    cat archive.zip | tar -xvf - works on BSD/OS X, but not with gnu tar.
    – Eir Nym
    Jul 24 '15 at 16:57
5

Repost of my answer:

BusyBox's unzip can take stdin and extract all the files.

wget -qO- http://downloads.wordpress.org/plugin/akismet.2.5.3.zip | busybox unzip -

The dash after unzip is to use stdin as input.

You can even,

cat file.zip | busybox unzip -

But that's just redundant of unzip file.zip.

If your distro uses BusyBox by default (e.g. Alpine), just run unzip -.

BusyBox is available in Cygwin.

0

(improved for Windows) IF you have Java JDK (big if!)

 get_zip_content | jar x
 # xv to list while extracting
 # optionally specify entries to extract; default is all
 # supply full /path_to_jdk/bin/jar if it's not in PATH

I rate this about 7/10 on the kludge scale.

1
  • Note: jar ignores permissions stored in the zip file. Executables are extracted as standard files (without the x persmission).
    – SWilk
    Feb 12 '20 at 9:24
0

Thanks to Eir Nym comment I tried bsdtar from bsdtar package on Linux (Ubuntu) and it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.