()
| 175 | } |
| 176 | |
| 177 | start() { |
| 178 | const { execute: uploadFilePiece } = uploadFilePieceApi(); |
| 179 | |
| 180 | const formData = new FormData(); |
| 181 | formData.append("file", this.file.file.slice(this.rangeStart, this.rangeEnd)); |
| 182 | this.abortController = new AbortController(); |
| 183 | |
| 184 | this.worker = uploadFilePiece({ |
| 185 | url: this.file.pieceUrl, |
| 186 | data: formData, |
| 187 | params: { |
| 188 | offset: this.rangeStart |
| 189 | }, |
| 190 | onUploadProgress: (progressEvent: any) => this.onProgress(progressEvent.loaded), |
| 191 | signal: this.abortController.signal |
| 192 | }) |
| 193 | .then(() => this.onCompleted()) |
| 194 | .catch((e) => this.onError(e)); |
| 195 | |
| 196 | this.status = "uploading"; |
| 197 | } |
| 198 | |
| 199 | stop() { |
| 200 | this.status = "stopping"; |
no test coverage detected