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