Skip to content

Instantly share code, notes, and snippets.

@tugrul
Created March 5, 2018 15:09
Show Gist options
  • Select an option

  • Save tugrul/7f11cb32e0a5a05c0a57f15f2f69c8cc to your computer and use it in GitHub Desktop.

Select an option

Save tugrul/7f11cb32e0a5a05c0a57f15f2f69c8cc to your computer and use it in GitHub Desktop.
archive.org S3 like storage using Node.JS AWS API
const AWS = require('aws-sdk');
const s3 = new AWS.S3({
endpoint: 'http://s3.us.archive.org',
accessKeyId: 'yourkeyid', // set your access key id
secretAccessKey: 'youraccesskey', // set your access key
signatureVersion: 'v2',
s3ForcePathStyle: true
});
const params = {
Bucket: 'mybucket', // set your unique bucket name
Key: 'test-file.txt',
Body: 'Hello!'
};
s3.putObject(params, (err, data) => {
if (err) {
return console.error(err);
}
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment