Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lib/api/upload/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export interface ProgressEvent {
}

const DEFAULT_PROGRESS_INTERVAL = 1000;

const BIG_FILE_THRESHOLD = 50 * 1000 * 1000 * 1000 // 50GB
const BIG_FILE_PART_SIZE = 10 * 1024 * 1024; // 10MB
const normalizeProgress = (current, last) => {
current.totalBytes = Math.max(current.totalBytes, last.totalBytes);
current.totalPercent = Math.max(current.totalPercent, last.totalPercent);
Expand Down Expand Up @@ -206,6 +207,9 @@ export class Upload extends EventEmitter {

const f = await getFile(input, this.sanitizerOptions);
f.customName = this.overrideFileName;
if (f.size > BIG_FILE_THRESHOLD){
this.uploader.setPartSize(BIG_FILE_PART_SIZE);
}
this.uploader.addFile(f);

this.startProgressInterval();
Expand Down