title: AWS Image upload data to S3 from form is corrupt
body: <p>I am using multer in a Lambda function to upload an image through an API POST request I am building, this is part of a form on my website.</p>
  <p>This is the console log from cloud watch:</p>
  <pre><code>{
    fieldname: 'logo_image',
    originalname: '8824.png',
    encoding: '7bit',
    mimetype: 'image/png',
    destination: '/tmp/upload',
    filename: 'f7f44f5c39304937d10e90ceb7e9ddbb',
    path: '/tmp/upload/f7f44f5c39304937d10e90ceb7e9ddbb',
    size: 1376654
  }
  
  </code></pre>
  <p>This is my js express function that accepts the image using multer:</p>
  <pre><code>routes.post('/', upload.single('logo_image'), async (req, res) =&gt; {
    const file = req.file
    // here I am just going into another function to check the form data is valid
    await checkTicketId(req, res)
  });
  </code></pre>
  <p>I then upload the data to my S3 bucket:</p>
  <pre><code>const result = await uploadFile(req.file)
  
  function uploadFile(file, policy_id) {
    const fileStream = fs.createReadStream(file.path)
    const uploadParams = {
      Bucket: bucketName,
      Body: fileStream,
      Key: file.filename,
    }
    return s3.putObject(uploadParams).promise()
  }
  </code></pre>
  <p>The data is uploaded fine, however its just some binary nonsense. And If I return the object I get data like this:</p>
  <pre><code>IHDR  �      �2�p   IDATx���i�$I�%��Ǣj�WVVf]���9zw�X�h&quot;\D  �  ��7�@ -�h���S�]gfU��n�����EDE��##&quot;�ȡݠ���ws3UQ��� �?P ��_@�  P`3�5l'�.��w�[�!     J�0���?��@� ���1h`�8A�H@�$�@D C1�@�d`��� �ְ5 A21��rʫ ���ɀ� F̈ ���
  ��
  k��p8 $��/4Ly3�A���e&quot;IH�&lt;/�ߞ�
  �C�R&amp;���&lt;��j�����b �eY�N���nY�K����x�0��Y(�Dx L(d�$� p�pE��5��Q������ٟ�u�K��ΰ  $@��N������� ��0���?~���?����?�ዏ&gt;^���tw��\��+�����_۴IҊ@�1�����_~��������s�=%�&gt;��W��D�z
  '4c�@̺�[��_M�@D^b{)}�'�b�W���p}su3��ӡ�����xw\�u� ����
  onts=s9�B ��89֠@�Cw�K�~Z�Ӳ���XݗEp��&quot;P�uٓ�]롅�����飛'7W���&lt;�zz}uSJ)tǲ���/�;.��O�_����8�*y�����vsu����j����Cy&lt;MWW��j.�Ja������������w����Ջ�/��}~{w��
  �a��t�2�M4PB�W_|�X!x���ږs1��
  ���l6�P��NZ�8=ǲ����,���mXl�*��`���'_���_(�o�����?�����v�
  ��a#���?�������C$  �� ��^!�.D=�/Σ�~O���+u�rz�%���.���f��K���x�}ɚ�4Ѭ� �����8m�&amp;7�@�jf�_|���Y�[=pq�v9�5����0a���h�&lt;�;��:)#��B�_��.���H`@��� �8�b�bF�P(&quot;K���Z�^8F(i0�f�X������bC �0����M�����}��|CQo��կ�A�ר?��/�VZk�s��b
  ��n�A�jr0�Z�&amp;�n�wL�i��E`�����&lt;�A���p!�� ��E�yp�*�����dD( ���  M����k�֧�EC�T�V�����Ԋ+�l�&lt;�H�Y1�!�ʤIe��r���
  ɱ���L3$��O� �-�z`�Kv���O7nK�.����9CE���Ŧ����|����g�&lt;��W�����V���
  �rw���1���D��*�J
  </code></pre>
  <p>Ideally I want it stored as .webp, I have also tried using upload instead of putObject and changing file extension. There doesn't seem to be any buffer data I can use either on the req.file property.</p>
  <p>Any insight into this would be helpful, I've been stuck on it for a while now and I've enabled binary data through the API on AWS as well. Thanks!</p>