Serverless framework - uploading files to S3 become corrupted

I have created a sample serverless framework, it has a function to upload files on s3 but I am facing issues while uploading files. (Files are getting uploaded but it turns out to be corrupt.)

What types of files?

“Binary” files, e.g. ZIP are not working using the Node.js (if that’s what you have) SDK. I switched to this one:

That works for both ZIP and JAR files for me!

We are using CSV files and excel.