Я пробовал много разных способов, чтобы получить очень большие видеофайлы (8 ГБ) в контейнер хранения Azure.
Решение, на которое я натолкнулся, - это загрузка непосредственно из компонента Angular 8 с использованием хранилища Azure. REST API.
Это нормально работает для небольших файлов, но когда я пытаюсь загрузить файл размером 8 ГБ, происходит сбой последовательно примерно на 8% со следующей ошибкой:
![enter image description here](https://i.stack.imgur.com/vKpt3.png)
Я не уверен, что мне не хватает. Вот мой код:
component.ts
onFileChange(event) {
this.currentFile = event.target.files[0];
this.upload();
}
upload() {
this.uploading = true;
this.percentComplete = 1;
let url = this.uploadUrl.split('?');
let uploadUrl = url[0] + '/' + this.currentFile.name + '?' + url[1];
const req = new HttpRequest('PUT', uploadUrl, this.currentFile, {
reportProgress: true,
headers: new HttpHeaders({ 'x-ms-blob-type': 'BlockBlob' })
});
this.http.request(req).subscribe(event => {
// Via this API, you get access to the raw event stream.
// Look for upload progress events.
if (event.type === HttpEventType.UploadProgress) {
// This is an upload progress event. Compute and show the % done:
let percentDone = Math.round((100 * event.loaded) / event.total);
if (percentDone === 0) {
percentDone = 1;
}
console.log(event.loaded + ' of ' + event.total);
this.percentComplete = percentDone;
} else if (event instanceof HttpResponse) {
this.uploading = false;
if (event.status === 201) {
this.successEventHandler(event);
}
}
});
}
html
<input [promiseBtn]="uploading" (change)="onFileChange($event)" id="fileAttachmentBtn" name="file-attachment" type="file" class="file-attachment-btn__label" />