Appearance
@loontail/minecraft-kit / ProgressSnapshot
Type Alias: ProgressSnapshot
ts
type ProgressSnapshot = {
bytesDownloaded: number;
currentFile?: string;
overallBytesDownloaded: number;
overallPercent: number;
overallTotalBytes: number;
stage: ProgressStage;
stagePercent: number;
totalBytes: number;
};Defined in: src/install/progress-tracker.ts:69
Snapshot pushed to InstallProgressTracker subscribers.
Two matched byte pairs, so a ratio is always self-consistent: bytesDownloaded / totalBytes describe the current stage, overallBytesDownloaded / overallTotalBytes the whole run. Never divide across the pairs.
Example
ts
import type { ProgressSnapshot } from "@loontail/minecraft-kit";
const render = (s: ProgressSnapshot) => {
console.log(`${s.stage} ${s.bytesDownloaded}/${s.totalBytes} bytes (${s.stagePercent.toFixed(0)}%)`);
console.log(`overall ${s.overallBytesDownloaded}/${s.overallTotalBytes} (${s.overallPercent.toFixed(0)}%)`);
if (s.currentFile) console.log(` ${s.currentFile}`);
};Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
bytesDownloaded | readonly | number | Bytes downloaded so far in the current stage. Denominator is totalBytes. | src/install/progress-tracker.ts:74 |
currentFile? | readonly | string | - | src/install/progress-tracker.ts:81 |
overallBytesDownloaded | readonly | number | Bytes downloaded so far across every stage. Denominator is overallTotalBytes. | src/install/progress-tracker.ts:78 |
overallPercent | readonly | number | - | src/install/progress-tracker.ts:72 |
overallTotalBytes | readonly | number | Expected bytes of the whole run. | src/install/progress-tracker.ts:80 |
stage | readonly | ProgressStage | - | src/install/progress-tracker.ts:70 |
stagePercent | readonly | number | - | src/install/progress-tracker.ts:71 |
totalBytes | readonly | number | Expected bytes of the current stage. | src/install/progress-tracker.ts:76 |