CreateS3UploadFlow()
createUploadFlow 함수는 S3 파일 업로드를 위한 플로우를 생성합니다.
Signature
createS3UploadFlow: <Input, S3Config, Result>(config: CreateS3UploadFlowConfig<Input, S3Config, Result>) => CreateS3UploadFlowReturn<Input, Result>
Parameters
Parameter | Type | Description |
---|---|---|
config | CreateS3UploadFlowConfig<Input, S3Config, Result> |
Returns
CreateS3UploadFlowReturn<Input, Result>
Example
const { uploadFile, uploadFiles } = createUploadFlow({
prepareUpload: async ({name} : {name : string}) => {
return {
name: name,
type: "image",
}
},
uploadFileToS3: async ({ name, type }) => {
return { name, type, imgUrl: "https://example.com" }
},
})
const result = await uploadFile({ name: "example" }) // { name: "example", type: "image", imgUrl: "https://example.com" }
const results = await uploadFiles([{ name: "example" }, { name: "example2" }]) // { fulfilled: [{ name: "example", type: "image", imgUrl: "https://example.com" } , ...], rejected: [] }