Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k 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 (44.4k 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.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...