title: nodeJS AWS S3 upload data wrong encoding
body: <p>I have a little app to upload a file to AWS S3, it is uploading ok, but when I download the file from S3 bucket, it is encoded, shows type:buffer etc...</p>
  
  <p>if I upload the same file from the console, it shows fine.</p>
  
  <p>Here the code to upload</p>
  
  <pre><code>const fs = require('fs');
  const AWS = require('aws-sdk');
  const s3 = new AWS.S3({
      accessKeyId: process.env.AWS_ACCESS_KEY,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
  });
  
  const fileName = 'su.csv';
  const uploadFile = () =&gt; {
      fs.readFile(fileName, (err, data) =&gt; {
          if (err) throw err;
          const params = {
              Bucket: 'mybukk22-test', // pass your bucket name
              Key: 'su.csv', // file will be saved as testBucket/contacts.csv
              Body: JSON.stringify(data, null, 2)
          };
          s3.upload(params, function (s3Err, data) {
              if (s3Err) throw s3Err
              console.log(`File uploaded successfully at ${data.Location}`)
          });
      });
  };
  
  uploadFile();
  </code></pre>
  
  <p>Is the problem on the body? how to save the same file as on client?
  thanks</p>