s3-js: got upload working successfully, required CORS * and Headers * and public-read ACL

This commit is contained in:
Logan Allen 2020-04-23 23:55:44 -04:00
parent ff313fb720
commit ce1f7c957b

View File

@ -25,48 +25,12 @@ export default class S3Client {
});
}
createBucket(name) {
let params = {
Bucket: name,
ACL: "public-read"
};
return new Promise((resolve, reject) => {
if (!this.s3) {
reject({ error: 'S3 not initialized!' });
return;
}
this.s3.createBucket(params, (error, data) => {
if (error) {
reject({ error });
} else {
resolve({ data });
}
});
});
}
listBuckets() {
return new Promise((resolve, reject) => {
if (!this.s3) {
reject({ error: 'S3 not initialized!' });
return;
}
this.s3.listBuckets({}, (error, data) => {
if (error) {
reject({ error });
} else {
resolve({ data });
}
});
});
}
upload(bucket, filename, buffer) {
let params = {
Bucket: bucket,
Key: filename,
Body: buffer
Body: buffer,
ACL: 'public-read'
};
return new Promise((resolve, reject) => {
if (!this.s3) {