title: Create Gzip Compressed JSON file and upload on S3 bucket using NodeJS
body: <p>I wanted to upload GZip compressed JSON file on S3 bucket.I am struggling with this, can someone help me on this.As, I am trying to use zlib npm module for Gzip compression of JSON file but coudn't get a method to achieve this.</p>
  
  <p>Below is my upload method to upload Gzip compressed JSON file on S3 :</p>
  
  <pre><code>    var uploadEntitlementDataOnS3 = function(next, event,
      jsonFileContent, filePath, results) {
      console.log("uploadEntitlementDataOnS3 function 
      started",jsonFileContent);
          var bufferObject = new 
      Buffer.from(JSON.stringify(jsonFileContent));
          var s3 = new AWS.S3();
          var params = {
              Bucket: configurationHolder.config.bucketName,
              Key: filePath,
              Body: bufferObject,
              CacheControl: 'no-cache',
              ContentType: "application/json",
              ContentEncoding: 'gzip'
          }
          s3.putObject(params, function(err, data) {
              if (err) {
                  console.log(err, err.stack);
                  next(err);
              } else {
                  next(null, filePath);
              }
          });
      };
  </code></pre>
  
  <p>Thanks</p>