How to get contents of a text file from AWS s3 using a lambda function?

后端 未结 3 1806
栀梦
栀梦 2020-12-13 05:54

I was wondering if I could set up a lambda function for AWS, triggered whenever a new text file is uploaded into an s3 bucket. In the function, I would like to get the conte

3条回答
  •  孤城傲影
    2020-12-13 06:31

    You can use data.Body.toString('ascii') to get the contents of the text file, assuming that the text file was encoded used ascii format. You can also pass other encoding types to the function. Check out Node-Buffer for further details.

提交回复
热议问题