Skip to content

Instantly share code, notes, and snippets.

@scripting
Created August 9, 2017 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scripting/5fae68dd05a27ef595a916e75b7be773 to your computer and use it in GitHub Desktop.
Save scripting/5fae68dd05a27ef595a916e75b7be773 to your computer and use it in GitHub Desktop.
Hello world for S3 in JavaScript
var AWS = require ("aws-sdk");
var s3 = new AWS.S3 ();
const params = {
Bucket: "bloatware.org",
Key: "/testing/hello.txt",
Body: "Hello World",
ContentType: "text/plain",
ACL: "public-read"
};
s3.putObject (params, function (err, data) {
if (err) {
console.log ("\nThere was an error: " + err.message + "\n");
}
else {
console.log ("\nEverything's good. This is the data that was returned by AWS: \n\n" + JSON.stringify (data, undefined, 4) + "\n");
}
});
@scripting
Copy link
Author

This example goes with this question.

scripting/Scripting-News#19 (comment)

Dave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment