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?

vect
  • 225
  • 3
  • 9
  • 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. – Baris Demiray 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

3 Answers3

6

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.

Saftever
  • 161
  • 1
  • 3
1

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

AmokHuginnsson
  • 173
  • 1
  • 8
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.

dave_thompson_085
  • 2,910
  • 1
  • 15
  • 18
  • Note: `jar` ignores permissions stored in the zip file. Executables are extracted as standard files (without the `x` persmission). – SWilk Feb 12 '20 at 09:24