feat(medusa): Add streaming to Minio fileservice (#1619)
This commit is contained in:
1 parent
9fa4238ee4
commit
812ba65d8f
5 files changed
+138
-40
No files matched your search
@@ -15,3 +15,5 @@ Learn more about how you can use this plugin in the [documentaion](https://docs.
|
||||
secret_access_key: "YOUR-SECRET-KEY",
|
||||
}
|
||||
```
|
||||
|
||||
Optionally a `download_url_duration` option can be specified to change the valid duration of presigned download links. The duration is configured in seconds. (Default = 60 seconds)
|
||||
@@ -14,6 +14,7 @@ class DigitalOceanService extends AbstractFileService {
|
||||
this.secretAccessKey_ = options.secret_access_key
|
||||
this.region_ = options.region
|
||||
this.endpoint_ = options.endpoint
|
||||
this.downloadUrlDuration = options.download_url_duration ?? 60 // 60 seconds
|
||||
}
|
||||
|
||||
upload(file) {
|
||||
@@ -45,7 +46,7 @@ class DigitalOceanService extends AbstractFileService {
|
||||
})
|
||||
}
|
||||
|
||||
delete(file) {
|
||||
async delete(file) {
|
||||
this.updateAwsConfig()
|
||||
|
||||
const s3 = new aws.S3()
|
||||
@@ -110,7 +111,7 @@ class DigitalOceanService extends AbstractFileService {
|
||||
const params = {
|
||||
Bucket: this.bucket_,
|
||||
Key: `${fileData.fileKey}`,
|
||||
Expires: 60, // 60 seconds
|
||||
Expires: this.downloadUrlDuration
|
||||
}
|
||||
|
||||
return await s3.getSignedUrlPromise("getObject", params)
|
||||
|
||||
Reference in new issue
Block a user