mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-25 19:23:55 +00:00
* stream upload unknown size files behind a new option streamingUploadSizeless COMPANION_STREAMING_UPLOAD_SIZELESS for tus * allow for all upload protocols seems to be working closes #5305 * refactor and fix bug where progress was not always emitted * fix type * fix progress throttling only do it on total progress * Improve progress in UI - only show progress percent and total bytes for files that we know the size of. (but all files will still be included in number of files) - use `null` as an unknown value for progress and ETA, allowing us to remove ETA from UI when unknown - `percentage` make use of `undefined` when progress is not yet known - don't show percentage in UI when unknown - add a new state field `progress` that's the same as `totalProgress` but can also be `null` * fix build error * format * fix progress when upload complete * use execa for companion load balancer if not, then it leaves zombie companion instances running in the background when e2e stops have to be manually killed before running e2e again * update docs and tests for new state.progress * revert progress/totalProgress * improve doc * remove option streamingUploadSizeless we agreed that this can be considered not a breaking change * change progress the to "of unknown" * revert * remove companion doc * add e2e test
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
export interface DeterminateFileProcessing {
|
|
mode: 'determinate'
|
|
message: string
|
|
value: number
|
|
}
|
|
export interface IndeterminateFileProcessing {
|
|
mode: 'indeterminate'
|
|
message?: string
|
|
value?: 0
|
|
}
|
|
export type FileProcessingInfo =
|
|
| IndeterminateFileProcessing
|
|
| DeterminateFileProcessing
|
|
|
|
// TODO explore whether all of these properties need to be optional
|
|
interface FileProgressBase {
|
|
uploadComplete?: boolean
|
|
percentage?: number // undefined if we don't know the percentage (e.g. for files with `bytesTotal` null)
|
|
// note that Companion will send `bytesTotal` 0 if unknown size (not `null`).
|
|
// this is not perfect because some files can actually have a size of 0,
|
|
// and then we might think those files have an unknown size
|
|
// todo we should change this in companion
|
|
bytesTotal: number | null
|
|
preprocess?: FileProcessingInfo
|
|
postprocess?: FileProcessingInfo
|
|
}
|
|
|
|
// FileProgress is either started or not started. We want to make sure TS doesn't
|
|
// let us mix the two cases, and for that effect, we have one type for each case:
|
|
export type FileProgressStarted = FileProgressBase & {
|
|
uploadStarted: number
|
|
bytesUploaded: number
|
|
}
|
|
export type FileProgressNotStarted = FileProgressBase & {
|
|
uploadStarted: null
|
|
bytesUploaded: false
|
|
}
|
|
export type FileProgress = FileProgressStarted | FileProgressNotStarted
|