Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var JsonLoader = require('./utils/json-loader');
- app.use(function (req, res, next) {
- var jl = new JsonLoader();
- if(firstChar != 123) {
- req.pipe(zlib.createGunzip()).pipe(jl);
- } else {
- req.pipe(jl);
- }
- req.once('data', function (chunk) {
- var firstChar = chunk[0];
- console.log(firstChar);
- });
- jl.on('data', function (obj) {
- req.body = obj;
- });
- jl.on('end', next);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement