Remove ReadChunkFromFile

dashboard
Pat Hartl 2023-01-02 16:09:37 -06:00
parent 38212521af
commit a8bbd8623b
2 changed files with 0 additions and 29 deletions

View File

@ -41,7 +41,6 @@ class Uploader {
this.Key = data.key; this.Key = data.key;
this.GetChunks(); this.GetChunks();
for (let chunk of this.Chunks) { for (let chunk of this.Chunks) {
let dataChunk = yield this.ReadChunkFromFile(this.File, chunk);
let formData = new FormData(); let formData = new FormData();
formData.append('file', this.File.slice(chunk.Start, chunk.End)); formData.append('file', this.File.slice(chunk.Start, chunk.End));
formData.append('start', chunk.Start.toString()); 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() { GetChunks() {
for (let currentChunk = 1; currentChunk <= this.TotalChunks; currentChunk++) { for (let currentChunk = 1; currentChunk <= this.TotalChunks; currentChunk++) {
let start = (currentChunk - 1) * this.MaxChunkSize; let start = (currentChunk - 1) * this.MaxChunkSize;

View File

@ -54,8 +54,6 @@ class Uploader {
this.GetChunks(); this.GetChunks();
for (let chunk of this.Chunks) { for (let chunk of this.Chunks) {
let dataChunk = await this.ReadChunkFromFile(this.File, chunk);
let formData = new FormData(); let formData = new FormData();
formData.append('file', this.File.slice(chunk.Start, chunk.End)); formData.append('file', this.File.slice(chunk.Start, chunk.End));
@ -76,21 +74,6 @@ class Uploader {
} }
} }
ReadChunkFromFile(file: File, chunk: Chunk): Promise<string | ArrayBuffer> {
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() { GetChunks() {
for (let currentChunk = 1; currentChunk <= this.TotalChunks; currentChunk++) { for (let currentChunk = 1; currentChunk <= this.TotalChunks; currentChunk++) {
let start = (currentChunk - 1) * this.MaxChunkSize; let start = (currentChunk - 1) * this.MaxChunkSize;