Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions packages/store-s3/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class S3Store {
* @param {string} [options.region] - Region name
* @param {string} [options.endpoint] - Endpoint URL
* @param {string} [options.bucket] - Bucket name
* @param {string} [options.acl] - Access Control List (ACL) policy
*/
constructor(options = {}) {
this.options = { ...defaults, ...options };
Expand Down Expand Up @@ -115,11 +116,17 @@ export default class S3Store {
* @returns {Promise<string>} File created
*/
async createFile(filePath, content) {
const putCommand = new PutObjectCommand({
Bucket: this.options.bucket,
Key: filePath,
Body: content,
});
const params = {
Bucket: this.options.bucket,
Key: filePath,
Body: content,
};

if (this.options.acl) {
params.ACL = this.options.acl;
}

const putCommand = new PutObjectCommand(params);

try {
const fileExists = await this.fileExists(filePath);
Expand Down Expand Up @@ -181,11 +188,15 @@ export default class S3Store {
* @returns {Promise<string>} Updated file URL
*/
async updateFile(filePath, content, options) {
const putCommand = new PutObjectCommand({
const params = {
Bucket: this.options.bucket,
Key: filePath,
Body: content,
});
};
if (this.options.acl) {
params.ACL = this.options.acl;
}
const putCommand = new PutObjectCommand(params);

try {
const { ETag } = await this.client().send(putCommand);
Expand Down