Skip to content

Commit

Permalink
Added aws s3 private provider
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Andrew Hinchey <[email protected]>
  • Loading branch information
ChrisHinchey committed Aug 24, 2023
1 parent 54d3e5f commit bfbde1e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions providers/aws-s3/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// aws-s3 provider

module.exports = {
init: (config) => {
const s3 = new AWS.S3(config);

return {
async upload(file) {
// code to upload file to S3
},

async delete(file) {
// code to delete file from S3
},

async isPrivate() {
return true;
},

async getSignedUrl(file) {
const params = {
Bucket: config.params.Bucket,
Key: file.path,
Expires: 60, // URL expiration time in seconds
};

const signedUrl = await s3.getSignedUrlPromise("getObject", params);
return { url: signedUrl };
},
};
},
};

0 comments on commit bfbde1e

Please sign in to comment.