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. I want to
The Javascript AWS SDK supports streaming the body of the API responses so API calls like getting a large S3 blob of binary data can be streamed to Javascript functions.
lambda.invoke(lambdaDef)
.createReadStream()
.on('data', function(data) {
console.log("Got data:", data.toString())
})
You'll get the Payload
of the response as data
.
The Javascript lambda functions don't support any streaming options except for logging and inbound events, just a callback that returns a chunk of data.
The Java SDK does have a specific handler for streams -com.amazonaws.services.lambda.runtime.RequestStreamHandler.