title: File getting corrupted on S3 when upload using serverless framework
body: <p>I am using Serverless Framework which has functionality of the File(Image/Excel) upload on S3 bucket of AWS. While uploading file I am using S3 service of "<strong><em>putObject</em></strong>" function with basic params for upload. Data of the file is being passed in Binary String format and gets uploaded on S3 bucket.</p>
  
  <p>My Local system uploads the file on S3 bucket perfectly as per requirement but when serverless framework is deployed using the "<strong><em>Lambda Function</em></strong>" of AWS for the same function a corrupted file gets uploaded.</p>
  
  <p>Below given is my demo code:</p>
  
  <pre><code>//Router
  app.post('/api/fileUpload', controller.fileUpload);
  
  //Controller
  exports.fileUpload = (req, res) =&gt; {
  let params = {
      Bucket: 'BucketName',
      Key: 'keyofAWSS3',
      ContentType: 'image/jpeg',
      Body: data,//Data of file to be uploaded in Binary String format
      ACL: 'private'
  };
  
  //to create file on S3
  return s3Service.CreateToS3(params).then((fromResolve) =&gt; {
    console.log(fromResolve);
  }).catch((error) =&gt; {
     console.log(error);
  }); 
  
  }
  
  //Service
  exports.CreateToS3 = (params) =&gt; {
    let s3 = new AWS.S3();
  
  return new Promise((resolve, reject) =&gt; {
  
      //Upload as a file to S3
      s3.putObject(params, (err, data) =&gt; {
  
      if (err) {
          reject(err);
      }
  
      resolve(data);
  
        });
      });
   };
  </code></pre>