gzip

Unzip part of a file using python gzip module

Hi, I am trying to unzip a gzipped file in Python using the gzip module. The pre-condition is that, I get 160 bytesof data at a time, and I need to unzip it before I request for the next 160 bytes. Partial unzipping is OK, before requesting the next 160 bytes. The code I have is import gzip import time import StringIO file = open('inp...

Unzipping part of a .gz file using python

So here's the problem. I have sample.gz file which is roughly 60KB in size. I want to decompress the first 2000 bytes off this file. I am running into CRC check failed error cuz I guess the gzip CRC field appears at the end of file, and it requires the entire gzipped file to decompress. Is there a way to get around this? I dont care abou...

How to 'minify' Javascript code

JQuery has two versions for download, one is Production (19KB, Minified and Gzipped), and the other is Development (120KB, Uncompressed Code). Now the compact 19kb version, if you download it, you will see is still a javascript executable code. How did they compactify it? And how can I 'minify' my codes like that too? ...

Compress data before storage on Google App Engine

I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest I accomplish this (...

Problem with GZIP JSON AJAX response

Hello, I am facing a problem, while encoding the response that I send back for an AJAX request, using GZIP. Can anyone give me some pointers on this please? There is an AJAX request from the JSP, An action class (Struts) at the server side handles the request, The response is prepared as a JSON object, The JSON string is written to th...

WCF GZip Compression Request/Response Processing

How do I get a WCF client to process server responses which have been GZipped or Deflated by IIS? On IIS, I've followed the instructions here on how to make IIS 6 gzip all responses (where the request contained "Accept-Encoding: gzip, deflate") emitted by .svc wcf services. On the client, I've followed the instructions here and here on...

How do I get the InputStream of decompressed data from an InputStream of GZIPed data?

I call a service which returns a gzipped file. I have the data as an InputStream (courtesy of javax.activation.DataHandler.getInputStream();) from the response. What I would like to do is, without writing anything to disk, get an InputStream of the decompressed data in the file that is in the archive. The compressed file in this case i...

how to use gzip in classic ASP

Dear experts, I would like to use GZIP compression in classic ASP.I don't know the code for the same.Please help me what line of code should i put to use GZIP compression in classic ASP for my website. I also want to compress CSS and javascript.Suggest howto do that. Your help in this regard will be highly appreciated. regards, sunny...

How to Decompress nested GZip (TGZ) files in C#

I am receiving a TGZ file that will contain one plain text file along with possibly one or more nested TGZ files. I have figured out how to decompress the main TGZ file and read the plain text file contained in it, but I have not been able to figure out how to recognize and decompress the nested TGZ files. Has anyone come across this p...

GZIP Compression causing web page expiration

I have implemented GZIP compression on a few of my ASP.NET pages, using a class that inherits from System.Web.UI.Page, and implementing the OnLoad method to do the compression, like so: protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Internet.Browser.IsGZIPSupported()) { bas...

IIS6 not doing gzip compression when including Via header in request

I have some static content going through a CDN. I am using IIS6's built in compression (gzip & deflate) for static content and this is working fine when I request it. However, when the CDN makes the initial request for the content, it is not being returned compressed. They therefore don't have compressed content to forward to people r...

boost filtering_istream gzip_decompressor uncompressed file size

I am using the boost filtering stream object to read gzipped files. Works great! I would like to display a progress bar for the amount of the file that has been processed. I need find the input uncompressed file size. Does the gzip decompressor have access to the original file size from the gzipped file? I couldn't find it on the boo...

How to GZip every file separately

Easy and fast question, I just don't want to have all of them in a big tar :-) ...

Asp.net with iis6/gzip : can a dynamic page send back its content without compression ?

When gzip is activated in an IIS6 website for dynamic content (aspx pages) : it seems it compress all responses. Is there a way to exclude just a page ? From best to worst solutions : by adding a specific response header (which could be done dynamicly) ? by providing some specials markups in the web.config ? (seems not possible unde...

Opening gzipped files for reading in C without creating temporary files

Hello, I have some gzipped files that I want to read in C via fopen and fscanf. Is there anyway to do this without having to gunzip the files to temporary files? Thanks. ...

How can I decompress a gzip stream with zlib?

Gzip format files (created with the gzip program, for example) use the "deflate" compression algorithm, which is the same compression algorithm as what zlib uses. However, when using zlib to inflate a gzip compressed file, the library returns a Z_DATA_ERROR. How can I use zlib to decompress a gzip file? ...

Compressing content with PHP ob_start() vs Apache Deflate/Gzip?

Most sites want to compress their content to save on bandwidth. However, When it comes to apache servers running PHP there are two ways to do it - with PHP or with apache. So which one is faster or easier on your server? For example, in PHP I run the following function at the start of my pages to enable it: /** * Gzip compress page o...

Serve Gzipped content with Java Servlets

Hi, I was wondering if there was an easy way to serve GZipped content with Java Servlets. I already have the app up and running so the modifications needed should be too heavy. I have access to the response object just at the end of the doPost/doGet method, so I'm looking for something like response.setGzip(true); It doesn't have to...

How to deal with deflated response by urllib2?

I currently use following code to decompress gzipped response by urllib2: opener = urllib2.build_opener() response = opener.open(req) data = response.read() if response.headers.get('content-encoding', '') == 'gzip': data = StringIO.StringIO(data) gzipper = gzip.GzipFile(fileobj=data) html = gzipper.read() Does it handle de...

Reading utf-8 characters from a gzip file in python

Hi, I am trying to read a gunzipped file (.gz) in python and am having some trouble. I used the gzip module to read it but the file is encoded as a utf-8 text file so eventually it reads an invalid character and crashes. Does anyone know how to read gzip files encoded as utf-8 files? I know that there's a codecs module that can help ...