Last active
March 27, 2020 03:02
-
-
Save ppshein/a3975e90ed9089d5a1d11d4ba59e35d7 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
const AWS = require("aws-sdk"); | |
const s3 = new AWS.S3({ apiVersion: "2006-03-01" }); | |
const fs = require("fs"); | |
AWS.config.update({ | |
accessKeyId: "", | |
secretAccessKey: "", | |
region: "ap-southeast-1", | |
Bucket: "mobile-ayaplus-backend-dev", | |
}) | |
const params = { | |
Bucket: `mobile-ayaplus-backend-dev`, | |
Key: `ayapay-merchant/mytestimage.png`, | |
Body: fs.createReadStream(`./mytestimage.png`), | |
ContentType: 'image/png', | |
StorageClass: 'STANDARD_IA' | |
}; | |
s3.upload(params, function(err, result) { | |
if (err) { | |
throw err; | |
} | |
console.log(`File uploaded successfully. ${JSON.stringify(result)}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment