Advertisement
Guest User

Untitled

a guest
Sep 29th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var JsonLoader = require('./utils/json-loader');
  2.  
  3. app.use(function (req, res, next) {
  4.     var jl      = new JsonLoader();
  5.  
  6.     if(firstChar != 123) {
  7.         req.pipe(zlib.createGunzip()).pipe(jl);
  8.     } else {
  9.         req.pipe(jl);
  10.     }
  11.  
  12.     req.once('data', function (chunk) {
  13.         var firstChar = chunk[0];
  14.         console.log(firstChar);
  15.     });
  16.  
  17.     jl.on('data', function (obj) {
  18.         req.body = obj;
  19.     });
  20.  
  21.     jl.on('end', next);
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement