-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christopher Andrew Hinchey <[email protected]>
- Loading branch information
1 parent
54d3e5f
commit bfbde1e
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
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
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 }; | ||
}, | ||
}; | ||
}, | ||
}; |