Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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.3k 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 !

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.6k users

Browse Categories

...