File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed
Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change 11import { BaseResponse } from "../../types" ;
22import { respToFileChoice } from "../helpers" ;
33import { RequestClient } from "../request" ;
4+ import { createFileUploadFormData } from "../utils" ;
45import { FileUploadParams , FileUploadResponse } from "./interfaces/file" ;
56export class File {
67 constructor ( private readonly client : RequestClient ) { }
78
89 upload = async ( file : Blob | Buffer , params ?: FileUploadParams ) : Promise < FileUploadResponse > => {
9- return await this . client . fetchJSS (
10- `/v1/store/file` ,
11- "POST" ,
12- file ,
13- {
14- key : params ?. key ,
15- overwrite : params ?. overwrite ,
16- temp_public_url : params ?. temp_public_url ,
17- } ,
18- params ?. content_type && {
19- "Content-Type" : params . content_type ,
20- }
21- ) ;
10+ const formData = createFileUploadFormData ( file , params ) ;
11+
12+ return await this . client . fetchJSS ( `/v1/store/file` , "POST" , formData ) ;
2213 } ;
2314
2415 retrieve = async ( key : string ) => {
You can’t perform that action at this time.
0 commit comments