MCPcopy Index your code
hub / github.com/callstack/agent-device / formatUploadProgressEvent

Function formatUploadProgressEvent

src/upload-progress.ts:68–85  ·  view source on GitHub ↗
(event: UploadProgressEvent)

Source from the content-addressed store, hash-verified

66}
67
68function formatUploadProgressEvent(event: UploadProgressEvent): string {
69 switch (event.type) {
70 case 'start':
71 return `Uploading ${event.fileName} (${formatBytes(event.totalBytes)}) via ${formatStage(event.stage)} upload`;
72 case 'resume':
73 return `Resuming ${event.fileName} at ${formatBytes(event.transferredBytes)} of ${formatBytes(
74 event.totalBytes,
75 )}`;
76 case 'progress':
77 return `Uploaded ${formatBytes(event.transferredBytes)} of ${formatBytes(
78 event.totalBytes,
79 )} (${formatPercent(event.transferredBytes, event.totalBytes)})`;
80 case 'fallback':
81 return `Direct upload did not complete; retrying ${event.fileName} with ${formatStage(
82 event.to,
83 )} upload`;
84 }
85}
86
87function uploadProgressStepBytes(totalBytes: number): number {
88 return Math.max(

Callers 1

Calls 3

formatStageFunction · 0.85
formatBytesFunction · 0.70
formatPercentFunction · 0.70

Tested by

no test coverage detected