20260629154839
This commit is contained in:
1 parent
e687846eb4
commit
bb596f3245
41 files changed
+5735
-86
No files matched your search
@@ -5,6 +5,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/credentials"
|
||||
@@ -52,6 +54,17 @@ func UploadToRustFS(ctx context.Context, file io.Reader, key string, size int64,
|
||||
return err
|
||||
}
|
||||
|
||||
func CopyObject(ctx context.Context, sourceKey string, targetKey string) error {
|
||||
source := strings.ReplaceAll(url.PathEscape(fmt.Sprintf("%s/%s", bucket, sourceKey)), "%2F", "/")
|
||||
|
||||
_, err := S3Client.CopyObject(ctx, &s3.CopyObjectInput{
|
||||
Bucket: aws.String(bucket),
|
||||
CopySource: aws.String(source),
|
||||
Key: aws.String(targetKey),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteFromRustFS 删除
|
||||
func DeleteFromRustFS(ctx context.Context, key string) error {
|
||||
_, err := S3Client.DeleteObject(ctx, &s3.DeleteObjectInput{
|
||||
|
||||
Reference in new issue
Block a user