Skip to content

Instantly share code, notes, and snippets.

@pori
Created March 22, 2015 20:49
Show Gist options
  • Save pori/d6a21abef1552a5aff02 to your computer and use it in GitHub Desktop.
Save pori/d6a21abef1552a5aff02 to your computer and use it in GitHub Desktop.
An s3 example for Node.js
var fs = require('fs'),
AWS = require('aws-sdk'),
s3 = new AWS.S3();
var body = fs.createReadStream('./profile.jpeg');
var date = new Date();
var params = {
Bucket: 'rapidoapp',
Key: "avatar-" + date.getTime() + ".jpeg",
Body: body
};
s3.putObject(params, function(err, data) {
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment