expressjs / compression

Node.js compression middleware
MIT License
2.77k stars 241 forks source link

How to know if files are being successfully compressed? #88

Closed sandysaders closed 8 years ago

sandysaders commented 8 years ago

Hello,

I'm wondering to see how I can know if files are being compressed? So far I have the following:

var express = require('express')
var compression = require('compression')
var zlib = require('zlib');

var app = express()
app.use(compression({level: 9}))
...

When I make a request at localhost how do I confirm in the browser that the files that we're sent over are in fact gzipped and uncompressed via the browser?

I get the following: screen shot 2016-07-21 at 2 20 42 pm screen shot 2016-07-21 at 2 22 02 pm

screen shot 2016-07-21 at 2 21 02 pm

hadijaveed commented 8 years ago

+1 I have the same question

blakeembrey commented 8 years ago

It doesn't look like it's compressed. Usually a compressed response will contain Content-Encoding: gzip in the response headers.

hadijaveed commented 8 years ago

yes but with same code posted by @sandysaders it gives the same Accept-Encoding: gzip, deflate, sbch. Can you suggest how can I make it work ?

blakeembrey commented 8 years ago

Can you share some code so I can reproduce it? The original issue was a general question as far as I know.

hadijaveed commented 8 years ago

I am sorry there was a typo in my code. So it is working now !

blakeembrey commented 8 years ago

Awesome, great to hear. I'll close this as the question was answered, but if there's any other issues feel free to continue the discussion.

hilleer commented 8 years ago

It might help others if you post the solution. I found this issue having a similar problem, but couldn't see what was wrong, as you didn't post the solution 👎

blakeembrey commented 8 years ago

@hilleer It might help if you have an issue to post the issue you're having too. This issue was a question, and the question was answered https://github.com/expressjs/compression/issues/88#issuecomment-235494836.

hilleer commented 8 years ago

Fair enough :-) It was more like a solution - to post the solution he found.