Guest User

Untitled

a guest
Jan 17th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. exports.helloWorld = function helloWorld(req, res) {
  2. if (req.body.message === undefined) {
  3. res.status(400).send('No message defined!');
  4. } else {
  5. const zlib = require('zlib');
  6.  
  7. // Obtain JSON stream from your source...
  8.  
  9. res.writeHead(200, {
  10. 'content-encoding': 'gzip',
  11. });
  12.  
  13. json.pipe(zlib.createGzip()).pipe(res);
  14. }
  15. };
Add Comment
Please, Sign In to add comment