初始化模版工程
This commit is contained in:
21
components/image-editor/utils/upload.ts
Normal file
21
components/image-editor/utils/upload.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
import { getSTSToken } from '@/package/apis/oss'
|
||||
import { createCustomOSSUploader } from '@bty/uploader'
|
||||
|
||||
export async function uploadFile(
|
||||
file: File,
|
||||
filePath: string,
|
||||
headers?: Record<string, string>,
|
||||
) {
|
||||
const uploader = createCustomOSSUploader(getSTSToken)
|
||||
return await uploader.multipartUpload({
|
||||
file,
|
||||
filePath,
|
||||
options: {
|
||||
headers,
|
||||
onProgress: (progress: number) => {
|
||||
console.log(progress)
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user