feat: 添加 S3 上传功能,包含预签名 URL 获取和上传选项
This commit is contained in:
19
src/utils/aws/s3.ts
Normal file
19
src/utils/aws/s3.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { client, safeClient } from "@/api";
|
||||
|
||||
interface PresignedUrlResponse {
|
||||
uploadUrl: string;
|
||||
fileUrl: string;
|
||||
key: string;
|
||||
expiresIn: number;
|
||||
}
|
||||
|
||||
interface UploadOptions {
|
||||
onProgress?: (progress: number) => void;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
export function uploadToS3(file: File, options: UploadOptions = {}) {
|
||||
const { onProgress, signal } = options || {};
|
||||
|
||||
// 1. 获取预签名 URL
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./aws/s3";
|
||||
export * from "./ionic-helper";
|
||||
export * from "./is";
|
||||
export * from "./pattern";
|
||||
|
||||
Reference in New Issue
Block a user