Created
March 5, 2018 15:09
-
-
Save tugrul/7f11cb32e0a5a05c0a57f15f2f69c8cc to your computer and use it in GitHub Desktop.
archive.org S3 like storage using Node.JS AWS API
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
| 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