Files
test1/components/image-editor/utils/upload.ts
2026-03-20 07:33:46 +00:00

22 lines
462 B
TypeScript

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)
},
},
})
}