EasyManuals Logo

Amazon AWS SDK User Manual

Amazon AWS SDK
19 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #17 background imageLoading...
Page #17 background image
on('httpData', function(chunk, response) { ... })
Note
If you register a httpData callback, response.data will still contain serialized output for the
entire request. It will be your responsibility to remove the default 'httpData' listener if you do not
wish to have the extra parsing and memory overhead from the built-in handlers.
The httpData event is used to stream response data from the service packet-by-packet.This event is
mostly used for large responses, when it is inefficient (or impossible) to load the entire response into
memory.
Note that this event contains an extra chunk parameter containing the actual data passed on by the
server.
The always event triggers a callback in any final state of a request, i.e., both done and fail. Use this
callback to handle any request cleanup that must be executed regardless of the success state. Note that
if you do intend to use response data inside of this callback, you must check for the presence of
response.data or response.error before attempting to access either property. For example:
Multiple Callbacks and Chaining
You can register multiple callbacks on any request object.The callbacks can be registered for different
events, or all for the same event. In addition, you can chain callback registration, for example:
request.
on('success', function(response) {
console.log("Success!");
}).
on('error', function(response) {
console.log("Error!");
}).
on('complete', function() {
console.log("Always!");
}).
send();
The above example will print either "Success! Always!", or "Error! Always!", depending on whether the
request succeeded or not.
Version 0.9.1-pre.2 : Preview
13
AWS SDK for Node.js Getting Started Guide
on('httpData', function(chunk, response) {
... })

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Amazon AWS SDK and is the answer not in the manual?

Amazon AWS SDK Specifications

General IconGeneral
CategorySoftware Development Kit (SDK)
DeveloperAmazon Web Services (AWS)
LicenseApache License 2.0
PurposeTo enable developers to interact with AWS services from their applications.
Supported LanguagesJava, Python, JavaScript, .NET, Ruby, PHP, Go, C++
Supported AWS ServicesAll AWS services
Operating SystemsWindows, macOS, Linux
Latest VersionVaries by SDK and language. Refer to the official AWS documentation for the specific SDK.
RepositoryGitHub (for many SDKs)
DocumentationAvailable on the AWS website.
SDK FeaturesAPI abstraction, request signing, error handling, retry logic, data serialization, and support for various authentication methods.

Related product manuals