0
votes

I am new in aws lambda(Node) function, i get file object using s3.getObject() function, but after get file how to make zip in lambda function i don't know...

Can any body help me, how to make zip file and upload on s3 bucket.

1

1 Answers

0
votes

You could use JSZip, then the s3.putObject function to save the zip file.

Just one caveat, if the files you are zipping are large Lambda isn't the right solution for you. Large files mean you will need more memory which increases your cost and the maximum memory size is 1.5GB. Also you're limited on local disk space so you have to consider the size of both the source file and the resulting zip output. Rather, use Lambda to respond to S3 events (file created) then send a message to SQS with the file information and have that service load the files from S3, zip them and then put them back to S3.