Is it possible to pipe from stdin to gzip?

Solution 1:

gzip and its auxilliary commands all read from STDIN by default. We can test this with a really simple test:

$ echo testing | gzip | zcat
testing

Or something more exotic to prove that wasn't a fluke:

$ dd if=/dev/urandom of=bigfile bs=1024 count=102400
102400+0 records in
102400+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 6.42114 s, 16.3 MB/s

$ sha1sum bigfile 
25b4832d3e738e70721d86695ea7a767a3afb229  bigfile

$ cat bigfile | gzip | zcat | sha1sum 
25b4832d3e738e70721d86695ea7a767a3afb229  -

That suggests to me that your s3cmd output is dirty or malformed in some way. Try redirecting to file (rather tha providing a real filename) and then looking at the output in something like head. Or download it properly and compare.