Created
March 22, 2015 20:49
-
-
Save pori/d6a21abef1552a5aff02 to your computer and use it in GitHub Desktop.
An s3 example for Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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