Created
June 24, 2015 17:15
-
-
Save nicholasess/9bcd047ac11fce46b15f to your computer and use it in GitHub Desktop.
s3
This file contains hidden or 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 s3 = require('s3'); | |
var s3Options = { | |
accessKeyId: "", | |
secretAccessKey: "" | |
}; | |
var awsS3Client = new AWS.S3(s3Options); | |
var options = { | |
s3Client: awsS3Client, | |
// more options available. See API docs below. | |
}; | |
var client = s3.createClient(options); | |
var params = { | |
localFile: './upload/teste.png', | |
s3Params: { | |
Bucket: "welearnfs", | |
Key: "welearnfs/content_images" | |
} | |
} | |
var uploader = client.uploadFile(params); | |
uploader.on('error', function(err) { | |
console.error("unable to upload:", err.stack); | |
}); | |
uploader.on('progress', function() { | |
console.log("progress", uploader.progressMd5Amount, | |
uploader.progressAmount, uploader.progressTotal); | |
}); | |
uploader.on('end', function() { | |
console.log("done uploading"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment