1 | const AWS = require('./aws-helper')
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | module.exports = async (opts = {}) => {
|
10 | if (opts.filepath) {
|
11 | const creds = new AWS.SharedIniFileCredentials({ filename: opts.filepath })
|
12 | AWS.config.credentials = creds
|
13 | }
|
14 | const awsParams = {
|
15 | params: {
|
16 | Bucket: 'trmr-animate-vpaid',
|
17 | ACL: 'public-read'
|
18 | }
|
19 | }
|
20 | if (opts.credentials) {
|
21 | Object.assign(awsParams, opts.credentials)
|
22 | }
|
23 | const s3 = new AWS.S3(awsParams)
|
24 | await s3.putObject({
|
25 | ContentType: 'application/json',
|
26 | Body: JSON.stringify({}),
|
27 | Key: 'test/access.json'
|
28 | }).promise()
|
29 | }
|