Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More docs examples

  • Loading branch information...
commit e2ba112858c745a769f9fb1945504e2497d0b8ee 1 parent 5562387
Andrew Chilton authored
Showing with 68 additions and 0 deletions.
  1. +68 −0 docs/operations.md
68 docs/operations.md
View
@@ -103,8 +103,76 @@
</tbody>
</table>
+### Examples ###
+
+#### Streaming Uploads (from file) ####
+
+```
+// you must run fs.stat to get the file size for the content-length header (s3 requires this)
+fs.stat(__filename, function(err, file_info) {
+ var bodyStream = fs.createReadStream( __filename );
+
+ var options = {
+ BucketName : bucket,
+ ObjectName : 'amazon.js',
+ ContentLength : file_info.size,
+ Body : bodyStream
+ };
+
+ s3.PutObject(options, function(err, data) {
+ fmt.dump(err, 'err');
+ fmt.dump(data, 'data');
+ });
+});
+```
+
## GetObject ##
* [GetObject on AWS](http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectGETacl.html)
+### Params ###
+
+<table>
+ <thead>
+ <tr>
+ <th width="20%">Param Name</th>
+ <th width="10%">Required</th>
+ <th width="10%">Type</th>
+ <th width="60%">Notes</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>BucketName</td>
+ <td>required</td>
+ <td>special</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+### Examples ###
+
+#### Streaming Downloads ####
+
+```
+var options = {
+ BucketName : 'pie-17',
+ ObjectName : 'javascript-file.js',
+};
+
+s3.GetObject(options, { stream : true }, function(err, data) {
+ fmt.dump(err, 'err');
+ fmt.dump(data, 'data');
+
+ // stream this file to stdout
+ fmt.sep();
+ fmt.title('The File');
+ data.Stream.pipe(process.stdout);
+ data.Stream.on('end', function() {
+ fmt.sep();
+ });
+});
+```
+
(Ends)
Please sign in to comment.
Something went wrong with that request. Please try again.