Download/Upload files using GridFS on AWS Lambda with Node.js


I am porting my express node.js API to AWS Lambda and I am currently stuck by reading and writing files to mongoDB GridFS. The data I would like to store is mostly images and PDF documents.

Somehow I can not get the piping of the stream to work.

This is how I did it before

const getImage = (req: any, res: Response) => {

Does anyone have any hints on how to use GridFS on Lambda?

Is piping/streaming not supported on AWS Lambda? Can I download the whole stream inside the lambda and return this object?

Cheers! Marc