0 votes
1 view
in AWS by (16.7k points)

I have an AWS Lambda function, and I need to invoke it from my node app and stream the result back to the client. I've looked in the docs but can't see a way to do this. I want to do something like this:

lambda.invoke(params).then(data => data.pipe(res))

or even

lambda.invoke(params, (err, data) => {

  // data should be a pipeable stream instead of buffered

  data.pipe(res)

})

1 Answer

0 votes
by (39.6k points)

API calls to get large S3 blob of binary data can be streamed. Check out this doc.

lambda.invoke(lambdaDef)

.createReadStream()

.on('data', function(data) {

  console.log("Got data:", data.toString())

})

You will receive the Payload of the response as data.

...