The General Availability (GA) release of the AWS SDK for Node.js is now available and can be installed through npm as aws-sdk. We have added a number of features since the preview release including bound parameters, streams, IAM roles for EC2 instances, version locking, and proxies.
Here are a couple of examples to help you to understand bound parameters and streams.
You can now pass parameters into the constructor of any service object. These parameters will be intelligently merged with request parameters for each call. This makes it easy to create a service object that is bound to a specific resource. In the following example we create an Amazon S3 service object and bind it to a bucket and key.
You can use the createReadStream() method on a request object to get a handle to a stream object which supports piping raw HTTP body data to a file. This is especially useful when streaming objects to streams like filesystem objects. The following example shows how you can stream an object from Amazon S3 directly to a file on disk:
Alternatively, you can register an 'httpData' event listener on the request object to access each chunk of data received across the wire (as Buffer objects):
For more examples, see the Getting Started Guide.
Here are some additional resources to get your started:
- AWS SDK for Node.js Homepage
- AWS SDK for Node.js Getting Started Guide
- AWS SDK for Node.js API Reference
- AWS SDK for Node.js on GitHub