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