(
url: string,
uri: string | File | Buffer | NodeJS.ReadStream,
name?: string,
contentType?: string,
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void,
)
| 719 | }; |
| 720 | |
| 721 | upload( |
| 722 | url: string, |
| 723 | uri: string | File | Buffer | NodeJS.ReadStream, |
| 724 | name?: string, |
| 725 | contentType?: string, |
| 726 | onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, |
| 727 | ) { |
| 728 | const fd = utils.addFileToFormData(uri, name, contentType); |
| 729 | return this.doAxiosRequest<FileUploadAPIResponse>('POST', { |
| 730 | url, |
| 731 | body: fd, |
| 732 | headers: fd.getHeaders ? fd.getHeaders() : {}, // node vs browser |
| 733 | token: this.getOrCreateToken(), |
| 734 | axiosOptions: { |
| 735 | timeout: 0, |
| 736 | maxContentLength: Infinity, |
| 737 | maxBodyLength: Infinity, |
| 738 | onUploadProgress, |
| 739 | }, |
| 740 | }); |
| 741 | } |
| 742 | |
| 743 | /** |
| 744 | * Shorthand function for get request |
no test coverage detected