title: Compression json in nodejs
body: <p>I have a server in nodejs written using connect. I am exposing some data as json. I have to compress the data before sending. I used the compress function in connect but I am not sure how to check the data if its compressed or not. Below is my code:</p>
  
  <pre><code>var connect = require('connect')
   , http = require('http');
  
  var app = connect()
  
   .use(connect.compress(console.log("I have compressed data")))
  
  .use(function(req, res){
  res.setHeader('Content-Type', 'application/json');
  //res.end("store_id: 'S3000981'");
  
  res.end('{"store_id": "S3000990"}');
  });
  http.createServer(app).listen(3000);
  </code></pre>
  
  <p>Any idea regarding this will be really helpful.</p>