gunzip

How to stream a gzip built on the fly in Python?

て烟熏妆下的殇ゞ 提交于 2021-02-08 09:51:15
问题 I'd like to stream a big log file over the network using asyncio. I retrieve the data from the database, format it, compress it using python's zlib and stream it over the network. Here is basically the code I use: @asyncio.coroutine def logs(requests): # ... yield from resp.prepare(request) # gzip magic number and compression format resp.write(b'\x1f\x8b\x08\x00\x00\x00\x00\x00') compressor = compressobj() for row in rows: ip, uid, date, url, answer, volume = row NCSA_ROW = '{} {} - [{}] "GET

Uncompress gzip from byte array in golang

邮差的信 提交于 2021-02-05 12:28:37
问题 I have a bunch of files that come from some web requests, and some are gziped, i need to unpack them and print them as a string. This is the first time I try using golang, I tried some examples I found online but can't get it working. Here's the last test I was trying: package main import ( "bytes" "compress/gzip" "fmt" "io/ioutil" ) func main() { content := []byte{72,84,84,80,47,49,46,49,32,50,48,48,32,79,75,13,10,84,114,97,110,115,102,101,114,45,69,110,99,111,100,105,110,103,58,32,99,104

Untar / Unzip *.tar.xz with ANT

本秂侑毒 提交于 2021-01-27 07:23:34
问题 I want to extract a tarball-file with *.tar.xz with ant. But I can only find, bunzip2, gunzip, unzip and untar as goals in ant and none of it seems to work. So how can I expand a tarball-file with *.tar.xz with ant? 回答1: The XZ format is not supported by the default Ant distribution, you'll need the Apache Compress Antlib. Download the full Antlib with all the dependencies from here (add the three jars ant-compress , common-compress , xz in the lib directory of your ant), and use this task:

Untar / Unzip *.tar.xz with ANT

一世执手 提交于 2021-01-27 07:23:12
问题 I want to extract a tarball-file with *.tar.xz with ant. But I can only find, bunzip2, gunzip, unzip and untar as goals in ant and none of it seems to work. So how can I expand a tarball-file with *.tar.xz with ant? 回答1: The XZ format is not supported by the default Ant distribution, you'll need the Apache Compress Antlib. Download the full Antlib with all the dependencies from here (add the three jars ant-compress , common-compress , xz in the lib directory of your ant), and use this task:

Untar / Unzip *.tar.xz with ANT

我只是一个虾纸丫 提交于 2021-01-27 07:21:09
问题 I want to extract a tarball-file with *.tar.xz with ant. But I can only find, bunzip2, gunzip, unzip and untar as goals in ant and none of it seems to work. So how can I expand a tarball-file with *.tar.xz with ant? 回答1: The XZ format is not supported by the default Ant distribution, you'll need the Apache Compress Antlib. Download the full Antlib with all the dependencies from here (add the three jars ant-compress , common-compress , xz in the lib directory of your ant), and use this task:

bash uncompress gz and store in variable

给你一囗甜甜゛ 提交于 2020-01-25 05:20:09
问题 I need to uncompress a .gz file and store it in a variable, so I can use it later. So, the idea is that I generate *.fastq.gz files, and I need to uncompress them and keep just the *.fastq file. Then, I would like to store its name in a variable, so I can call the file for further processing. Here, there is the code I am executing: input: $file.fastq.gz Where $file is the name of the file (it changes, as this code is inside a loop) reads=$(gunzip $file.fastq) echo $reads Does anybody know

Pipe multiple files (gz) into C program

谁说胖子不能爱 提交于 2020-01-06 13:12:49
问题 I've written a C program that works when I pipe data into my program using stdin like: gunzip -c IN.gz|./a.out If I want to run my program on a list of files I can do something like: for i `cat list.txt` do gunzip -c $i |./a.out done But this will start my program 'number of files' times. I'm interested in piping all the files into the same process run. Like doing for i `cat list.txt` do gunzip -c $i >>tmp done cat tmp |./a.out How can I do this? 回答1: There is no need for a shell loop: gzip

AJAX response gives a corrupted compressed (.tgz) file

青春壹個敷衍的年華 提交于 2020-01-03 08:47:11
问题 We are implementing a client-side web application that communicates with the server exclusively via XMLHttpRequests (and AJAX engine). The XHR responses usually are plain text with some XML on it but in this case, the server is sending compressed data in .tgz file type. We know for sure that the data that the server is sending is correct because if we use an HTTP command-line client such as curl, the file sent as response is valid and contains the expected data. However, when making an AJAX

Error loading webpage while parsing JSON-string

↘锁芯ラ 提交于 2019-12-25 02:53:12
问题 Please have a look at my code where I'm trying to compress data using connect.compress middleware. How can I parse JSON string in browser to get the decompressed data. When I try to hit localhost:2080 I'm getting Page loading error. Client code var options = { host: '127.0.0.1', port: 2080, path: "/", headers:{ 'accept-encoding': 'gzip' } }; var req = http.request(options, function(res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); var

What is the best way to gunzip files with Perl?

这一生的挚爱 提交于 2019-12-19 10:56:07
问题 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 $