diff --git a/wwwroot/js/Upload.js b/wwwroot/js/Upload.js index d3887df..57f3e3f 100644 --- a/wwwroot/js/Upload.js +++ b/wwwroot/js/Upload.js @@ -41,7 +41,6 @@ class Uploader { this.Key = data.key; this.GetChunks(); for (let chunk of this.Chunks) { - let dataChunk = yield this.ReadChunkFromFile(this.File, chunk); let formData = new FormData(); formData.append('file', this.File.slice(chunk.Start, chunk.End)); formData.append('start', chunk.Start.toString()); @@ -58,17 +57,6 @@ class Uploader { } }); } - ReadChunkFromFile(file, chunk) { - return new Promise((resolve, reject) => { - let reader = new FileReader(); - let blob = this.File.slice(chunk.Start, chunk.End); - reader.onload = () => { - resolve(reader.result); - }; - reader.onerror = reject; - reader.readAsArrayBuffer(blob); - }); - } GetChunks() { for (let currentChunk = 1; currentChunk <= this.TotalChunks; currentChunk++) { let start = (currentChunk - 1) * this.MaxChunkSize; diff --git a/wwwroot/js/Upload.ts b/wwwroot/js/Upload.ts index d67ded7..a3fb77e 100644 --- a/wwwroot/js/Upload.ts +++ b/wwwroot/js/Upload.ts @@ -54,8 +54,6 @@ class Uploader { this.GetChunks(); for (let chunk of this.Chunks) { - let dataChunk = await this.ReadChunkFromFile(this.File, chunk); - let formData = new FormData(); formData.append('file', this.File.slice(chunk.Start, chunk.End)); @@ -76,21 +74,6 @@ class Uploader { } } - ReadChunkFromFile(file: File, chunk: Chunk): Promise { - return new Promise((resolve, reject) => { - let reader = new FileReader(); - let blob = this.File.slice(chunk.Start, chunk.End); - - reader.onload = () => { - resolve(reader.result); - } - - reader.onerror = reject; - - reader.readAsArrayBuffer(blob); - }); - } - GetChunks() { for (let currentChunk = 1; currentChunk <= this.TotalChunks; currentChunk++) { let start = (currentChunk - 1) * this.MaxChunkSize;