gunzip

Uncompress a gzip file from CURL, on php

╄→尐↘猪︶ㄣ 提交于 2019-12-17 11:23:29
问题 Does anyone know how to uncompress the contents of a gzip file that i got with curl? for example: http://torcache.com/torrent/63ABC1435AA5CD48DCD866C6F7D5E80766034391.torrent responded HTTP/1.1 200 OK Server: nginx Date: Wed, 09 Jun 2010 01:11:26 GMT Content-Type: application/x-bittorrent Content-Length: 52712 Last-Modified: Tue, 08 Jun 2010 15:09:58 GMT Connection: keep-alive Expires: Fri, 09 Jul 2010 01:11:26 GMT Cache-Control: max-age=2592000 Content-Encoding: gzip Accept-Ranges: bytes

How to dump a compressed object for given key from Memcache?

浪子不回头ぞ 提交于 2019-12-11 14:42:18
问题 I'm using the following command to dump the compressed object for given key from memcached : cat <(printf "\x1f\x8b\x08\x00\x00\x00\x00\x00") <(memccat CACHE-KEY) | gunzip It prints the value (a JSON), but with the warning at the end: gzip: stdin: unexpected end of file I believe it may be missing last 4 bytes of checksum (ADLER32), but I'm not sure. What would be the proper way of dumping a compressed key value in a plain text format from Memcached caching service? 回答1: It looks like the

How to gunzip stream in nodejs?

╄→гoц情女王★ 提交于 2019-12-10 18:27:13
问题 I'm trying to accomplish quite an easy task but I'm a little bit confused and got stuck on using zlib in nodejs. I'm building functionality that includes me downloading file from aws S3 which is gziped, unzipping it and reading it line by line. I want to accomplish all of this using streams as I believe it is possible to do so in nodejs. Here is my current code base: //downloading zipped file from aws s3: //params are configured correctly to access my aws s3 bucket and file s3.getObject

opening a .tar.gz file with a single command

二次信任 提交于 2019-12-09 04:27:54
问题 when I download a .tar.gz file, I open it with two commands, first gunzip and then tar . Is it possible to open it with just one command? 回答1: tar xzf file.tar.gz The letters are: x - extract z - gunzip the input f - Read from a file, not stdin 回答2: You can use tar with a "z" argument tar xvfz mytar.tar.gz 回答3: If you don't have gnu tar it is still possible to open the file in a single step (although technically still two commands) using a pipe zcat file.tar.gz |tar x 回答4: How do I extract a

Extract file using bash script

ぃ、小莉子 提交于 2019-12-08 14:15:31
问题 I created a script which will extract all *.tar.gz file. This file is decompressed five times .tar.gz file, but the problem is that only the first *.tar.gz file is being extracted. for file in *.tar.gz; do gunzip -c "$file" | tar xf - done rm -vf "$file" What should I do this? Answers are greatly appreciated. 回答1: If your problem is that the tar.gz file contains another tar.gz file which should be extracted as well, you need a different sort of loop. The wildcard at the top of the for loop is

get the filesize of very large .gz file on a 64bit platform

蓝咒 提交于 2019-12-07 02:19:56
问题 According to the specifiction of gz the filesize is saved in the last 4bytes of a .gz file. I have created 2 files with dd if=/dev/urandom of=500M bs=1024 count=500000 dd if=/dev/urandom of=5G bs=1024 count=5000000 I gziped them gzip 500M 5G I checked the last 4 bytes doing tail -c4 500M|od -I (returns 512000000 as expected) tail -c4 5G|od -I (returns 825032704 as not expected) It seems that hitting the invisible 32bit barrier, makes the value written into the ISIZE completely nonsense. Which

Compress a string to gzip in Java

对着背影说爱祢 提交于 2019-12-06 21:15:12
问题 public static String compressString(String str) throws IOException{ if (str == null || str.length() == 0) { return str; } ByteArrayOutputStream out = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(out); gzip.write(str.getBytes()); gzip.close(); Gdx.files.local("gziptest.gzip").writeString(out.toString(), false); return out.toString(); } When I save that string to a file, and run gunzip -d file.txt in unix, it complains: gzip: gzip.gz: not in gzip format 回答1: Try to

What is the best way to gunzip files with Perl?

左心房为你撑大大i 提交于 2019-12-01 13:34:01
Is there a faster solution than my actual 'zcat' solution to gunzip files with Perl? A little benchmark: #!/usr/bin/perl use strict; use warnings; use Benchmark qw(cmpthese timethese); use IO::Uncompress::Gunzip qw(gunzip); my $re = qr/test/; my $bench = timethese($ARGV[1], { zcat => sub { if (defined open(my $FILE, "-|", "zcat " . $ARGV[0])) { while (<$FILE>) { print $_ if ($_ =~ $re); } close($FILE); } }, io_gunzip => sub { my $z = new IO::Uncompress::Gunzip $ARGV[0]; while (<$z>) { print $_ if ($_ =~ $re); } }, io_gunzip_getline => sub { my $z = new IO::Uncompress::Gunzip $ARGV[0]; while

is partial gz decompression possible?

本小妞迷上赌 提交于 2019-11-30 13:59:02
For working with images that are stored as .gz files (my image processing software can read .gz files for shorter/smaller disk time/space) I need to check the header of each file. The header is just a small struct of a fixed size at the start of each image, and for images that are not compressed, checking it is very fast. For reading the compressed images, I have no choice but to decompress the whole file and then check this header, which of course slows down my program. Would it be possible to read the first segment of a .gz file (say a couple of K), decompress this segment and read the

How to get few lines from a .gz compressed file without uncompressing

荒凉一梦 提交于 2019-11-29 19:41:41
How to get the first few lines from a gziped file ? I tried zcat, but its throwing an error zcat CONN.20111109.0057.gz|head CONN.20111109.0057.gz.Z: A file or directory in the path name does not exist. zcat(1) can be supplied by either compress(1) or by gzip(1) . On your system, it appears to be compress(1) -- it is looking for a file with a .Z extension. Switch to gzip -cd in place of zcat and your command should work fine: gzip -cd CONN.20111109.0057.gz | head On some systems (e.g., Mac), you need to use gzcat . On a mac you need to use the < with zcat: zcat < CONN.20111109.0057.gz|head If a