Created
January 31, 2020 18:30
-
-
Save JamesWoolfenden/ba1b1fba2ea6e1cd37a75c464e2574f5 to your computer and use it in GitHub Desktop.
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
// Load the AWS SDK for Node.js | |
var AWS = require('aws-sdk'); | |
// Set the region | |
AWS.config.update({ region: 'eu-west-1' }); | |
// Create S3 service object | |
var s3 = new AWS.S3({ apiVersion: '2006-03-01' }); | |
var params = { | |
Bucket: 'whosebucketisitanyway', | |
Key: 'hello-world.txt' | |
}; | |
s3.getObject(params, function (err, data) { | |
if (err) console.log(err, err.stack); // an error occurred | |
else console.log(data.Body.toString()); // successful response | |
/* | |
data = { | |
AcceptRanges: "bytes", | |
ContentLength: 3191, | |
ContentType: "image/jpeg", | |
ETag: "\"6805f2cfc46c0f04559748bb039d69ae\"", | |
LastModified: <Date Representation>, | |
Metadata: { | |
}, | |
TagCount: 2, | |
VersionId: "null" | |
} | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment